I am not able to update or create or delete record in Document Tasks

chandan31
Tera Contributor

Hi All,

 

I am not able to update or create or delete record in Document Tasks using 

 

var gr = new GlideRecord('sn_doc_task');
gr.addEncodedQuery('number=DOCT0001005');
gr.addQuery('parent','HRC0231097');
gr.query();
if(gr.next()){
    //gr.short_description = 'Must be  printers that are broken again...';
    gr.setWorkflow(false); //Disable business rules for this query
    gr.deleteRecord();
}
1 ACCEPTED SOLUTION

SANDEEP28
Mega Sage

@chandan31 

Document task table is in "Document templates" application scope. We don't have option to select this scope in background script. For this scope related error you need to create restricted caller access record.

 

Second way to achieved this is change your scope to "Document templates" and Create fix script. So this fix script will get created in "Document templates" only and then add your code. Then simply click on "Run Fix script".

 

Also in your code, parent is a reference field so use the HR case sys ID instead of HR case number

 

SANDEEP28_0-1689751870987.png

 

var gr = new GlideRecord('sn_doc_task');
gr.addEncodedQuery('number=DOCT0001111);
gr.addQuery('parent','a07f7b8e8a9370cbb354edfdffdfdfdf');
gr.query();
if(gr.next()){
gs.info(gr.number);
gr.setWorkflow(false); //Disable business rules for this query
gr.deleteRecord();

}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

View solution in original post

5 REPLIES 5

SANDEEP28
Mega Sage

@chandan31 

Document task table is in "Document templates" application scope. We don't have option to select this scope in background script. For this scope related error you need to create restricted caller access record.

 

Second way to achieved this is change your scope to "Document templates" and Create fix script. So this fix script will get created in "Document templates" only and then add your code. Then simply click on "Run Fix script".

 

Also in your code, parent is a reference field so use the HR case sys ID instead of HR case number

 

SANDEEP28_0-1689751870987.png

 

var gr = new GlideRecord('sn_doc_task');
gr.addEncodedQuery('number=DOCT0001111);
gr.addQuery('parent','a07f7b8e8a9370cbb354edfdffdfdfdf');
gr.query();
if(gr.next()){
gs.info(gr.number);
gr.setWorkflow(false); //Disable business rules for this query
gr.deleteRecord();

}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!