How to pass "previous " object in eventQueue() through Business rule and retrieve in Script Action..

sumitjumale
Kilo Contributor

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

20 REPLIES 20

BR Code on problem table


gs.eventQueue('customer.closeProblemExternal',current,previous, '');



Script Action Code:



var temp=event.parm1;


gs.log(temp.state);


Hi Sumit,



This is how eventQueue function works:


The gs.eventQueue function takes the following parameters:


FieldInput Value
NameThe name of the event triggered, set in quotation marks
RecordThe 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.
Parm1Passes 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}.
Parm2Passes 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.


Hi Anupama,,


Thanks for reply.. But I need complete object. I need all fields of previous.


Please can u suggest ..


syedfarhan
Kilo Sage

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


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.