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.

How to create demand from request change form in PPM

Zuri
Tera Expert

I need to create a demand from request change form of project management. I need demand information to be pulled from request change form. 

1 REPLY 1

Amit Gujarathi
Giga Sage
Giga Sage

HI @Zuri ,
I trust you are doing great.

  1. Create a new Demand record:

    • Use the ServiceNow API or script include to create a new Demand record.
    • Set the necessary fields such as title, description, priority, and any other relevant information.
  2. Pull information from the Request Change form:

    • Retrieve the required information from the Request Change form.
    • Identify the specific fields or data you need to populate in the Demand record.
  3. Map the data from the Request Change form to the Demand record:

    • Use JavaScript or Business Rules to map the data from the Request Change form to the corresponding fields in the Demand record.
    • Make sure to validate and transform the data as required.
// Assuming you have retrieved the Request Change form data in the 'requestChangeData' variable

// Create a new Demand record
var newDemand = new GlideRecord('pm_demand');
newDemand.initialize(); // Initializes the new record

// Map the data from the Request Change form to the Demand record
newDemand.setValue('title', requestChangeData.title);
newDemand.setValue('description', requestChangeData.description);
newDemand.setValue('priority', requestChangeData.priority);
// Map other relevant fields accordingly

// Save the new Demand record
var demandSysID = newDemand.insert();

// Optionally, you can redirect the user to the newly created Demand record
var demandURL = '/pm_demand.do?sys_id=' + demandSysID;
gs.addInfoMessage('Demand created successfully. <a href="' + demandURL + '">Click here</a> to view it.');

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi