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.

Want to build Copy Problem Functionality.

Community Alums
Not applicable

I want to build functionality "Copy Problem" Like Copy Incident in easy way. I did it in following way -

UI Action -

arshadansar_0-1748102134316.png

UI Action Script -

arshadansar_1-1748102160391.png

Script Include - 

arshadansar_2-1748102226142.pngarshadansar_3-1748102252449.png

 

This Functionality is working with this code. But in this UI action code i send all the details in the URL. And i don't want to send details in URL due to security reason. 
How can i achieve this in another way?

 

 

4 REPLIES 4

Robert H
Mega Sage

Hello @Community Alums ,

 

You just need the following code in your UI Action.

 

var fieldsToCopy = [
	'short_description',
	'description',
	'cmdb_ci'
];

var grCopy = new GlideRecord('problem');
grCopy.initialize();
fieldsToCopy.forEach(field => {
	grCopy.setValue(field, current.getValue(field));
});
var copySysID = grCopy.insert();

action.setRedirectURL(grCopy);

 

And please disable the Client checkbox:

 

RobertH_0-1748105211799.png

 

Regards,

Robert

 

Community Alums
Not applicable

In this solution you insert new problem record but i don't want to insert. Only show all the details in new record and agent can submit it manually after updating extra required details.

Community Alums
Not applicable

Hello @Robert H 

Community Alums
Not applicable

@Robert H 
I want similar to "Copy Incident" but less fields fill (short_description, description, company, configuration item, impact and urgency) in new problem record and not submitted automatically. Agent can able to submit manually after updating addition fields.
Thanks