Highlighted
Absent Member.. Absent Member..
Absent Member..
3510 views

Parameters Calling us.notify from Javascript

Hi experts,

Can anybody help me with the parameters for calling a rad application us.notify in my javascript.
The parameters must be:
application name: us.notify
name: RM Request Last Phase Close
record: $file

I have now the following syntax:
system.functions.rtecall("callrad",rteReturnValue,"us.notify",RM Request Last Phase Close,$file,false);
0 Likes
12 Replies
Highlighted
Highlighted
Absent Member.. Absent Member..
Absent Member..

I try to use this function but which parameter I have to set? I have now this:

function callUsNotify(file,fileSave, strNotificationName)
{
var rteReturnValue = new SCDatum();
var rteNames = new SCDatum();
var rteValues = new SCDatum();
var scMsgStrings = new SCDatum();
var argNames = new SCDatum();
var argVals = new SCDatum();


//Parameter names for RAD app us.notify
rteNames.push("RM Request Last Phase Close"); //Notification Name - INTO.NAME
rteNames.push("$file"); //Current File - INTO.FILE
rteNames.push("second.file"); //Save copy of the current file - INTO.OLD
//rteNames.push("names"); //Extra Arguements - INTO.ARGS
//rteNames.push("types"); //Extra Arguement Names - INTO.ARG.NAMES

//Adding arrays to an array is tricky. First we have to set the types by hand.
var argVal;

argVals.setType(8); //type array
argNames.setType(8); //type array


//Now we set the array type for rteValues and use system.functions.insert to get
//the arg arrays in properly into the rteValue array. You can't mix push() with
//system.functions.insert() or the rteValues array will become corrupt.

rteValues.setType(8);
rteValues=system.functions.insert(rteValues, 0, 1, strNotificationName);
rteValues=system.functions.insert(rteValues, 0, 1, file);
rteValues=system.functions.insert(rteValues, 0, 1, fileSave);

system.functions.rtecall("callrad",
rteReturnValue,
"us.notify", //RAD app name
rteNames,
rteValues,
false); //false to run in same thread, true to run in new thread


return 1;
}
0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Where are you calling it from ?

You need to call it with the parameters

file= current file

fileSave= old file

strNotificationName= name of notification record to call
0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Oh and its not very nice to just copy the entire script here.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Oke, but what is the current file and old file?
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

As Tommy asked...Where are you calling it from?

For example, if you are calling the script from a trigger, the current file is "record" and the old file is "oldrecord"

So you could call the script from a trigger with:

lib.<scriptname>.callUsNotify(record,oldrecord,"IM Open")

"IM Open" can be replaced with your notification name.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

I'm executing the script from the subroutine format control ocml.view.default.workorder.

There are some conditions in this script and if they are true it has to call the us.notify application.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

OK, so you are calling a scriptlibrary from subroutine in FC...why not call from Javascript in FC?

Either way, try this in formatctrl:

1. Initialization expressions:
$L.void=fduplicate($file0, $file)

2. Javascript
Add: true
Upd: true
Script:

lib.<scriptname>.callUsNotify(system.vars.$file,system.vars.$file0,"IM Open")

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hi Michael,
I want to use solution to send email, but I getting an error message :

Messages:
------------------
rcput cannot convert datum type(unknown) (us.notify,decide.msg.cond)
rcput cannot convert datum type(unknown) (us.notify,decide.msg.cond)
rcput cannot convert datum type(unknown) (us.notify,decide.msg.cond)

 

I created function "callUsNotify" in script library.

 

function callUsNotify(file,fileSave, strNotificationName)
{    
 var rteReturnValue = new SCDatum();
 var rteNames = new SCDatum();
 var rteValues = new SCDatum();
 var scMsgStrings = new SCDatum();
 var argNames = new SCDatum();
 var argVals = new SCDatum();
 
     
 //Parameter names for RAD app us.notify   
 rteNames.push("name");   //Notification Name - INTO.NAME
 rteNames.push("record");   //Current File - INTO.FILE 
 rteNames.push("second.file"); //Save copy of the current file - INTO.OLD
 //rteNames.push("names");   //Extra Arguements - INTO.ARGS
 //rteNames.push("types");   //Extra Arguement Names - INTO.ARG.NAMES
  
 //Adding arrays to an array is tricky. First we have to set the types by hand.
 var argVal;
  
 argVals.setType(8);  //type array
 argNames.setType(8); //type array
    
       
 //Now we set the array type for rteValues and use system.functions.insert to get
 //the arg arrays in properly into the rteValue array. You can't mix push() with
 //system.functions.insert() or the rteValues array will become corrupt.
  
 rteValues.setType(8);
 rteValues=system.functions.insert(rteValues, 0, 1, strNotificationName);
 rteValues=system.functions.insert(rteValues, 0, 1, file);
 rteValues=system.functions.insert(rteValues, 0, 1, fileSave);
  
 system.functions.rtecall("callrad",
         rteReturnValue,
         "us.notify", //RAD app name
         rteNames,
         rteValues,
         false); //false to run in same thread, true to run in new thread
 
 
 return 1; 
}


I calling script from trigger with:

lib.proUSnotify.callUsNotify(record,oldrecord,"CartItem Add")

0 Likes
Highlighted
Absent Member.
Absent Member.

it simply saying that condition your notification(CartItem Add) is not correct, check for same.
____________________________________
Assign Kudo, if found post useful and mark it accepted if solves the issue.
0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Experts,

How can we call this script from Script Library.

Do we need to initialize any thing in RAD before calling it from SL.

 

I have written a similar script and the notifications are getting created in eventout but without any values (Only Template).

I guess the values are not being passed to HTML Template.

Can someone help me with it..

 

Thanks,

VNK

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.