The CreatorCon Call for Content is officially open! Get started here.

Current Ticket Number in Record Producer

cnharris1
Kilo Sage

Good morning developers,

I'm sure there is an easy answer to this question but I have not been successful in figuring it out. My problem is that I'm building out a form using a record producer. I'm trying to capture the current ticket number that will be created once the user clicks submit and display it in info message. I am able to get the sys_id but I can't get the display value. I have used var req = current.sys_id.getDisplayValue(); but that's not working.

I've also tried using this: 

var agr                 =    new x_adosy_as.Agreement(current);
var req                 =    agr.record.number;

 

Here's the info message:

gs.addInfoMessage("Your Agreement Has Been Sent for Signature!"  + req);

Any help will be greatly appreciated!

 

Thanks,

 

 

chnarris

16 REPLIES 16

Jaspal Singh
Mega Patron
Mega Patron

Did you try current.number?

In addition, you are using the above in widget's server side code or directly on record produer's script field.

Jaspal Singh
Mega Patron
Mega Patron

Is above implemented in Business rule or via server side script of portal.

Better go with Business rule that runs After Insert on record producer table with below snippet.

(function executeRule(current, previous /*null when async*/) {

gs.addInfoMessage("Your Agreement Has Been Sent for Signature!"  + current.number);

})(current, previous);

 

Thanks for responding! I used your code in the business rule and it worked! But would I be able to use that same code inside the record producer script section? I tried it that way but it didn't work, am I doing something wrong or is using a business rule the only way to accomplish this?

Good to know it worked when used Business Rule.

Can you share complete script that is being used in record producer's section.