Current number value is not being passed to Catalog task's Request Item field

mattmg
Tera Guru

Hi All, 

 

I have a small button on the Requested Item, which allows me to create ad-hoc task and relate it to the current RITM:

 

var catalogtask = new GlideRecord("sc_task");

catalogtask.short_description = "Any other equipment - WEEE ticket";
catalogtask.description = "Please list all additional not registered devices in a flied 'Any Other equipment' ";
catalogtask.assignment_group = "af7227d6db57c410bf0e5858dc961925";
catalogtask.request_item = current.number;

var sysID = catalogtask.insert();

current.sc_task= sysID;
gs.addInfoMessage("WEEE " + catalogtask.number + " for any other equipment has been created");

action.setRedirectURL(catalogtask);

 

I did not change anything in this script in the last 4 months, but I noticed that

 

catalogtask.request_item = current.number;

 

is not passing the correctly number to the Request Item field on the new task:

mattmg_0-1713362536922.png

 

Can any advise what is going on, I can't figure it out.

 

I tried add .getDisplayValue(), and I can pass it to any string field.

 

14 REPLIES 14

@mattmg Could you try this. 

 

This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla

the same thing, it does populate the field, but when I save it, it wipes it out

are you working in global or custom scope

 

Global

when you save which record? already you have used insert(), most importantly where is that script written in business rule?(better be after insert)