The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Populate Request Form Field from Catalog Variable

james_walters
Giga Contributor

Hi

I need to populate the Request form Priority field based on the Priority the requester selects. I have added the field as a variable and onto the form, however I cannot get it to populate based on the selection I made on the catalog item.

I have tried a Catalog Item Client Script onSubmit but then it only takes that field. I tried a onLoad Client Script on the sc_request table but fails to update the field.

I've also tried a Record Producer and mapping the fields together, however that doesn't follow the same Cart format I need from the other catalog items I have.

Looking on the community the catalog_item UI Macro could help but I'm not confident to update.

Any help please? A lot of posts but not specifically setting a form field based on a variable.

Thanks

James

1 ACCEPTED SOLUTION

Hi



I've created a new workflow for this item and running a script during the workflow to populate the Priority.



var p = current.variables.priority;


var request = current.request.getRefRecord();
request.priority = p;
request.update();



This worked for me. Thanks for your help.



James


View solution in original post

10 REPLIES 10

Uncle Rob
Kilo Patron

What kind of thing are you building with?   Is it naturally a Catalog Item, Record Producer, Order Guide, or Wizard?



I do this all the time in Catalog Items.   Because you're reaching all the way up to request, you might need a runscript activity that looks something like this...



current.request.priority = current.variables.priority;



That assumes that the two fields track value EXACTLY the same way though.   You might want to double check that.




Some other things for your consideration from a process perspective:


- What does "priority" actually mean on a Request?   Are you actually assigning request records to people?


- What does "priority" actually mean if the users can select it themselves?


It's a Catalog Item, I tried a record producer but not working.


Catalog Items and Record Producers are built for two different purposes.   I wouldn't try switching building blocks for the purpose of populating one field.


Hi James,



Can you redirect to the demo instance where you are able to reproduce this so that we can take a look.