How to pass "previous " object in eventQueue() through Business rule and retrieve in Script Action..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 09:56 PM
Hi All,
I need to pass "previous " object in eventQueue() through Business rule and retrieve in Script Action. I am able to pass current object.. but I coudnt retrieve previous object wirh event.parm1.
Please suggest.
Regards,
Sumit Jumale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 10:08 PM
BR Code on problem table
gs.eventQueue('customer.closeProblemExternal',current,previous, '');
Script Action Code:
var temp=event.parm1;
gs.log(temp.state);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 10:12 PM
Hi Sumit,
This is how eventQueue function works:
The gs.eventQueue function takes the following parameters:
Field | Input Value |
---|---|
Name | The name of the event triggered, set in quotation marks |
Record | The record referenced when the condition in the script evaluates to true. Usually this is expressed as current, meaning the current record the business rule is working on. If the business rule is being triggered as part of a scheduled job, use a GlideRecord argument in its place. |
Parm1 | Passes a string value. Notification events pass the Sys ID of the user with the gs.getUserID()method. Other scripts can reference this string value as parm1 using the format ${event.parm1}. |
Parm2 | Passes a string value. Notification events pass the user name with the gs.getUserName() method. Other scripts can reference this string values as parm2 using the format ${event.parm2}. |
So you need to change your previous to something like previous.assigned_to then it will be retrieved in the event.parm1
PS: Hit answered, like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 10:16 PM
Hi Anupama,,
Thanks for reply.. But I need complete object. I need all fields of previous.
Please can u suggest ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 10:16 PM
Hi Sumit,
If you like to use previous object for all fields then i would suggest you can pass previous in BR.
In BR:
gs.eventQueue("customer.closeProblemExternal",previous,previous.assigned_to.name,null); // it will pass all the previous object
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2016 10:29 PM
Hi Syed,
I tried yo pass like this only..
but i am not able to retrieve 'previous object'
BR code:
gs.eventQueue('test123', previous,'', '');
my code in Script Action
try{
gs.log('testxxx','14bb5');
gs.log('Previous='+previous.short_description,'14bb5');
}
catch(error)
{
gs.log('error='+error,'14bb5');
}
error log:
error=TypeError: Cannot convert null to an object. |