convert idea into demand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 07:40 PM
i have to convert idea into demand by clicking on the ui action button if the investment is less than 10k$.
can any one help me to achieve this functionality
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2023 09:01 PM
this is the sample UI Action and script.may be it works.
UI Action record.
Name: "Convert to Demand"
Table: "Idea [idea]"
Action name: "convert_to_demand"
Order: Specify the appropriate order.
Visible: Set the appropriate configuration as needed.
Condition: Specify the appropriate condition as needed.
Script: Write the script. Here's an example:
(function executeAction(current, previous) {
var investment = current.investment; // Modify the field name as appropriate for the investment amount
if (investment < 10000) {
var demand = new GlideRecord('demand');
demand.initialize();
// Set the required fields
demand.short_description = current.short_description;
demand.description = current.description;
// Set other necessary fields
// Save the Demand record
var demandSysId = demand.insert();
// Update the Idea with relevant information
current.state = 3; // Change to the appropriate state, such as "Complete"
current.demand = demandSysId;
current.update();
} else {
gs.addErrorMessage("The idea cannot be converted to Demand because the investment amount is equal to or greater than $10,000.");
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 02:01 AM
I am not familiar with the idea and demand states, relationship etc. But this is somewhat of a standard UI action script that you can customize and use.
// Change the current record state to "Closed Complete"
current.state = 3; // Assuming "Closed Complete" state is represented by the value 3
ar gr = new GlideRecord('demand_table'); // Replace with the correct table name
gr.initialize();
gr.field_name=current.field_name; // if you want information in some fields
gr.field_name.setDisplayValue(current.field_name); // if you want information in some fields
gr.insert();
gs.addInfoMessage("Idea has been transformed to demand.");
For the investment is less than 10k condition, use the condition field in the UI action.