Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need to create catalog item to create/update/delete custom table data

Rajyalakshmi
Mega Guru

Hi Team,

 

I need to create catalog item to create/update/delete custom table data ,could you please suggest good practice.

2 ACCEPTED SOLUTIONS

AndersBGS
Tera Patron
Tera Patron

Hi @Rajyalakshmi ,

 

Not quite understand your question. You can off course create a catalog item, and then setup rules on the backend to create/update/delete.... What have you tried so far and where do you get stuck.

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

@Rajyalakshmi 

you can use catalog item for this with variables

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

sumityadav8
Tera Contributor

Hii @Rajyalakshmi,

I understood your use case. I actually got the same question in an interview.
To achieve this, you need to create a Record Producer with 3 variables:

  1. Table (Reference → sys_db_object)

  2. Description (String)

  3. Caller (Reference → sys_user)

Below is the script I used for mapping the variables dynamically.
You can apply the same logic:

// Ensure variable names match those defined in the Record Producer
var selectedTable = producer.select_table;
var caller = producer.caller;
var description = producer.short_description;

if (selectedTable == 'incident') {
var inc = new GlideRecord('incident');
inc.initialize();
inc.caller_id = caller;
inc.short_description = description;
inc.insert();
action.setRedirectURL(inc);
current.setAbortAction(true); // Prevent default record creation

} else if (selectedTable == 'problem') {
var prob = new GlideRecord('problem');
prob.initialize();
prob.caller_id = caller;
prob.short_description = description;
prob.insert();
current.setAbortAction(true); // Prevent default record creation
}

If this helps, please mark the answer as helpful in the ServiceNow Community 

Rajyalakshmi
Mega Guru

I have created catalog item with set of variables ,and implemented flow using create /update /delete record actions .It is working as expected .flow actions are very useful with no code ,able to achive requirement.