Add javascript library

94 views
Skip to first unread message

Quini

unread,
Jul 9, 2013, 6:38:40 AM7/9/13
to itpam...@googlegroups.com
Hi friends,
 
How can i add a .js library to ITPAM?. I need to use a funtion javascript with a itpam process. I have ITPAM 3.1 LOCA version.
 
Best Regards.

Andrés Jesús Márquez Martín

unread,
Jul 9, 2013, 7:11:15 AM7/9/13
to itpam...@googlegroups.com
Hola,

Lo mejor es que cojas el contenido del javascript y añadirlo a una variable de un dataset
luengo en el operador hacer un load(<Dataset.javascript>).
una vez cargado el contenido ya puedes ejecutar las funciones javascript. que 


2013/7/9 Quini <jchum...@gmail.com>
Hi friends,
 
How can i add a .js library to ITPAM?. I need to use a funtion javascript with a itpam process. I have ITPAM 3.1 LOCA version.
 
Best Regards.

--
You received this message because you are subscribed to the Google Groups "CA Process Automation Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to itpam-forum...@googlegroups.com.
To post to this group, send email to itpam...@googlegroups.com.
Visit this group at http://groups.google.com/group/itpam-forum.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Spencer Sivakumaran

unread,
Jul 9, 2013, 7:18:11 AM7/9/13
to itpam...@googlegroups.com
We have achieved this using a Dataset but I believe you can do this from a file.
In the Dataset create a multiline string to hold your function.
eg.CleanMessage
Add the function example below

function CleanMessage(OrgMessage)
{
    iStart = OrgMessage.indexOf("<![CDATA[");
    if (iStart > -1) {
        msg = OrgMessage.substring(iStart + 9);
        iEnd = msg.indexOf("]]");
        msg = msg.substring(0,iEnd);
        msg = msg.replace(/&lt;/g, "<");
        msg = msg.replace(/&gt;/g, ">");
        msg = msg.replace(/&quot;/g, "\"");
        msg = msg.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
        return msg;
    }
    else
    {
        msg = OrgMessage.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
        return msg;
    }
}

You first need to load the function in the Operator where you wish to use it
eg. load(Datasets[Process.CommonDataset].CleanMessage);
Where Process.CommonDataset is the name of the Dataset containing  CleanMessage function
Use the following to use it
Process.OriginalMessage = CleanMessage(Process.Message);

The Administrator Guide has the following for file based .js

Scripts located in the CA Process Automation User Resources can be inserted in a CA Process Automation script by the include(); statement. The explicit reference for the CA Process Automation User Resources is .c2ouserresources//, although when specified by the include() statement, relative paths, such as:

include("javascripts/javascript.js") 

reference a path within the CA Process Automation User Resources folder. In this example, the javascript.js script is in the .c2ouserresources//javascripts folder. The include(); statement is described in “Include Common Resources in CA Process Automation Scripts” of the User Guide.


Hope that helps
:)
Spencer
Reply all
Reply to author
Forward
0 new messages