- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2023 06:23 AM
Hello everyone, my requirement is, I had created a table called u_table_record with column label (u_user, u_name, u_email).
And also created catalog item(Demo Table) with variable User, Name, Email. When I submit the catalog item these data are mapped to to u_table_record. Please let me know if you have any idea regarding this. Thank You.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2023 06:46 AM
Depends on if you're using Flow (I think there's a create new Record Activity) or Workflow (probably a Script activity, using GlideRecord), but since you're using a Catalog Item you'll need to use the appropriate mechanism to:
- Create a record in your new table
- Populate that record with the values from your variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2023 08:55 AM
Hi @praveen1231 ,
In that case you have 3 options.
- Create a workflow & attach it to the catalog item under process engine tab. Add a run script activity after start node where you can use below script then connect that activity to End Node.
var gr = new GlideRecord('u_table_record');
gr.initialize();
gr.u_user = current.variables.user;
gr.u_email = current.variables.email;
gr.u_name = current.variables.name;
gr.insert();
2. Create a new flow designer add a action called as create record & select your table (u_table_record) & map the fields of the catalog form in that action.
3. No need of any flows or Workflow. You can create an onSubmit Catalog client script & use the below code.
On Submit Client Script
function onSubmit() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('AddRecord');
ga.addParam('sysparm_name', 'insertRecord');
ga.addParam('sysparm_user', g_form.getValue("user"));
ga.addParam('sysparm_email', g_form.getValue("email"));
ga.addParam('sysparm_name', g_form.getValue("name"));
ga.getXMLAnswer(rollback);
}
function rollback(answer) {
if (answer) {
alert('Record Inserted');
}
}
Script Include:
Client Callable : true
var AddRecord = Class.create();
AddRecord.prototype = Object.extendsObject(AbstractAjaxProcessor, {
insertRecord: function() {
var user = this.getParameter('sysparm_user');
var email = this.getParameter('sysparm_email');
var name = this.getParameter('sysparm_name');
var gr = new GlideRecord('u_table_record');
gr.initialize();
gr.u_user = user;
gr.u_email = email;
gr.u_name = name;
gr.insert();
return 'true';
},
type: 'AddRecord'
});
Mark my answer helpful & accepted if it helps you resolve your query.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2023 06:46 AM
Depends on if you're using Flow (I think there's a create new Record Activity) or Workflow (probably a Script activity, using GlideRecord), but since you're using a Catalog Item you'll need to use the appropriate mechanism to:
- Create a record in your new table
- Populate that record with the values from your variables