record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2024 11:05 AM
i have created the record producer form in custom table for user information update . already user information is pulled from another Database and stored in the custom table . once the user submits the record producer user information update form . it has to verify if the user who submits the form has record found in the custom table if the record is found it has to update the details in the custom table . if the user record not found there should be some error message popping in the record producer form . how this can be configured can some one pls explain in detail .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2024 10:12 PM
Hi ,
In Record producer script section , query your custom table for finding the user rec..If there is any record then update the fields in that record with record producer variable values.otherwise throw some error message using gs.addErrorMessage();
and finally give current.setAbortAction(true) for preventing the insert of record.
you can refer below script
var userRec = new GlideRecord('your custom user table');
userRec.addQuery('user',gs.getUserID()); //here give the appropriate query you want to finding the record
userRec.query();
if(userRec.next()){
userRec.field1 = producer.variablename1;
userRec.field2 = producer.variablename2;
userRec.update();
}
else{
gs.addErrorMessage('user not found');
}
current.setAbortAction(true);