Update custom table from a catalog item

alexm3
Kilo Expert

Hello,

I need some help with the following scenario:

Looking to update the fields on a custom table from a catalog item. On the catalog item  I have a field with reference to my custom table and 5 fields. Each field from the catalog item corresponds with a field from my custom table.

Looking to update one field, or two, or all from that catalog item. I was thinking to query the custom table and maybe map the fields but not sure how.

Any ideas?

Thanks,

Alex

 

4 REPLIES 4

dvp
Mega Sage
Mega Sage

Use run script activity and try the below code

var gr = new GlideRecord("your_custom_table");
gr.addQuery("sys_id", current.variables.REFRENCE_VARIABLE_NAME);
gr.query();
if (gr.next()) {
   gr.FIELD_NAME_ON_TABLE = current.variables.VARIABLE_NAME;
	gr.update();
}

Hi dvp.

That example is for one variable, but if I want to update 3 or 4 variables what should I do?

Thanks

Hi DVP, 

 

Have a question! 

 

I have already inserted variable values in my custom table. I used a bit different code, but created run script in workflow before task creation. It works great. Please see screen shoot attached. The only that doesn't work correctly is that the system populates in the 1st field of my table - RITM number and I need SCTASK. 

 

I understand why it happens, the SCTASK hasn't been created by then, so I understand that I need to update the table and to run a similar code that you have been offering, but I don't understand where should I do it? 

 

Do you think Client Script OnLoad for this catalog item might help? 

 

The goal is to have all this information in the related list of the SCTASK record. 

 

Please see below: 

find_real_file.png

can you share your code (which you said it is a bit different) here please?