The CreatorCon Call for Content is officially open! Get started here.

Business Rule condition getDisplayValue('document_id')

xiaix
Tera Guru

On this table:

find_real_file.png

I have this Advanced Condition

find_real_file.png

Question... is the "document_id" field on the sysapproval_approver table a calculated field for getDisplayValue()??

The reason I'm asking is because when all is said and done, I need this business rule condition to be:

find_real_file.png

Now, in Script Include code, this queries just fine and pulls back perfectly... but when I try the code in this business rule as a condition, it always comes up blank.

Why does getDisplayValue('approver') work in the condition, but not getDisplayValue('document_id') ??

14 REPLIES 14

Tried both methods... still doesn't work.



In my original post I pasted a screenshot of both methods, and they came back as blank.



find_real_file.png


xiaix
Tera Guru

find_real_file.png


David,



According to me, the getDisplayValue or getValue don't work with the document_id field is because it is not a referenced field. The type od the field in itself is DocumentID.



What I advice you is to put in your GlideRecord something like "your variable.addQuery('ysapproval_approver.document_id', "CONTAINS" or "START", "theValue");


So you can directly filter on the right record.


Kalaiarasan Pus
Giga Sage

Try this



if(current.source_table!='' && current.document_id!='')


  {


  var target = new GlideRecord(current.source_table);


  if(target.get(current.document_id))


  {


  gs.addInfoMessage(target.getDisplayValue());


  }


  }


Rahul Chaudhary
Tera Contributor

i am using this code in business rule but its not working. 

can any help me find out error?

var recovery_tier=current.getDisplayValue('recovery_tier');
//current.getValue('recovery_tier');
var gdt = new GlideDateTime();
gs.info("recovery tier--"+ recovery_tier);
gs.log("Hello World"+ recovery_tier);

//gs.print(current.recovery_tier + ' exists');
if(recovery_tier=="Criticality 5" || recovery_tier=="Criticality 4"){
gdt.addYearsUTC(1);
}if(recovery_tier=="Criticality 3" || recovery_tier=="Criticality 2" || recovery_tier=="Criticality 1"){
gdt.addYearsUTC(2);
}

current.expires = gdt.getDate();