Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Advance workflow button binding

AjeetKumar1
Archer Employee
Archer Employee

I have created a custom object which is being triggered on an AWF button, its working properly and displaying some alert messages.

However need to fetch some "numeric" and "attachment type" fields for validation it would be great if someone can direct me how i can get the syntax for these type of fields.

Currently using the following method for fetching the values which is not working:

EX: $CM.getFieldValue(ceo_threshhold_notification_field);

The below is not the complete code just a piece of code:

JS:

<script type="text/javascript">
var ceo_threshhold_notification_field = field_id_1;
var attachement_field = field_id_2;
Sys.Application.add_load(function() {
$('button_id').attr('href',"#");
$('button_id').removeAttr("onclick");
$('button_id').unbind("click");
if($('button_id > div').length) {
$('button_id > div').prop('onclick',null);
$('button_id > div').off('click');
$('button_id > div').removeAttr('onclick');
$('button_id > div').unbind("click");
$('button_id > div').click(function(){ Validation('attachement');return false; });
}
});
function Validation(type) {
alert("Working for AWF button validations.");
//fetching numeric field ceo_threshhold_notification_field 
//fetching attachment field attachement_field
validate value show validation message
validate value show validation message
}
</script>

David Petty‌ Ilya Khen David Merrick

8 REPLIES 8

Ilya_Khen
Champion III

Ajeet Kumar,

 

You need to check this forum, it has plenty of examples: RSA Archer Custom Objects 

 

I.e. numeric and text can be retrieved by the same method, like in here:

Possible to create a Custom Object Based on the string of a text field? 

 

Attachments, either the same way or by using API call, Jeff Letterman's tool can help you to find proper APIcall:

Archer API Templates - an Archer application to quickly test the Archer Web Services API, REST API, and Content API usin…

https://community.rsa.com/docs/DOC-98592  

DavidPetty
Archer Employee
Archer Employee

The $CM.getFieldValue() function should return the numeric value of a numeric field.  The function only works for text, numeric and date fields; no other fields.  For the attachment field you can go what I recommended before and do a calculated numeric field and get the count of the attachment field.  Just and FYI, that field has to be on the layout in order for the custom object to get its value.

 

Otherwise you can use the following to get the values of an attachment field,

$('input[id$="SelectedValues'+ fieldId +'"]').val();

 

 

 Advisory Consultant

The function only works for text, numeric and date fields; no other fields

For VLs too

Thanks David and llya, custom object is working for me,

However for fetching the calculated numeric field i am using the below old Js syntax:

document.getElementById("span_id").innerText; 

because the Archer inbuilt method "$CM.getFieldValue(numeric_field);" is returning me null value.

Custom object is working fine in every use case but is there any other way to fetch CAL numeric field in jquery format.

 

Secondly for attachment if we do not want CAL numeric field we can get the length of the attachment field by using below JS code:

var arr = [];
$("#table_id tbody tr").each(function(){
arr.push($(this).find("td:first").text());
});

Now arr.length will return the first column's length, in this case we can use this arr.length to validate the attachments  and special thing about this code here we do not need to wait to save the record it will work directly on any button, in short it's working as more real time. 

Calc fields are not supported by $CM.getFieldValue function, for that you use plain JQuery or JS.

document.getElementById("span_id").innerText; 

this Js is working for me in case of CAL numeric field.

Yep, pure JS

For shorthand, you can use $(span[id$="f'+fieldId+'c"]').text();

 Advisory Consultant