- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 03:29 AM
Suppose I am entering some data in a form of table u_candidate_details and when i submit or save the form a record will be inserted in table u_candidate_database and a pdf attachment will be added on the record that was created on table u_candidate_database . the attachment will be pdf of the form view u_candidate_details
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 04:02 AM
Hey Suprakash,
Write a INSERT BUSINESS RULE -
var gr = new GlideRecord ('u_candidate_database');
gr.addQuery(Filter_condition);
gr.query();
if(gr.next())
{
var rm = new sn_ws.RESTMessageV2();
rm.setHttpMethod('GET');
var url = gs.getProperty("glide.servlet.uri") + current.getTableName()+ '.do?PDF&sys_id=' + current.sys_id;
rm.setEndpoint(url);
rm.setBasicAuth(gs.getProperty('glide.user.userid'), gs.getProperty('glide.user.password'));
rm.saveResponseBodyAsAttachment(gr.getTableName(),gr.sys_id,current.number+".pdf");
var response = rm.execute();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 05:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 06:14 AM
Remove 4 to 8 lines and 16 as well.
And let me know if it is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 06:30 AM
Its not working Nayan.
Unable to create a PDF...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 06:37 AM
nayan.awadhiya@p5solutions.com Do i need to activate any plugins related to REST ?
I create 2 sys properties as mention earlier: glide.user.userid & glide.user.password and written a BR on Incident table after on Insert and pasted your code:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var rm = new sn_ws.RESTMessageV2();
rm.setHttpMethod('GET');
var url = gs.getProperty("glide.servlet.uri") + current.getTableName()+ '.do?PDF&sys_id=' + current.sys_id;
rm.setEndpoint(url);
rm.setBasicAuth(gs.getProperty('glide.user.userid'), gs.getProperty('glide.user.password'));
rm.saveResponseBodyAsAttachment(current.getTableName(),current.sys_id,current.number+".pdf");
var response = rm.execute();
})(current, previous);
Later i created a notification where i am getting an email but not with PDF
Correct me if i have done anything wrong.!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2017 06:38 AM
By default it is activated please cross check.