You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Difference of 2 fields in workspace using JavaScript API

Accepted answer
13
Views
1
Comments
edited Sep 10, 2015 10:00AM in UI Extensibility 1 comment

Content

Hi All,

I have been trying to populate the numerical difference of two fields in the workspace into a 3rd field using JavaScript API script in a browser control but I am not able to set the value of the field. Below is the code snippet. Any help/suggestions please.

 

 

Version

May 15

Code Snippet

             
function ondataupdated(obj)
{
    if (obj == "Incident") // Modified object = Incident?
    {
        var i = window.external.Incident;
		var ah = i.getCustomFieldByName("c$actual_hrs");
		var bh = i.getCustomFieldByName("c$budget_hrs");
		var rh = bh-ah;
		i.SetCustomFieldByName("c$remaining_hrs", rh); // I am struck here in passing the value of calculated difference "rh" to c$remaining_hrs
		alert(i.GetCustomFieldByName("c$remaining_hrs"));
		
    }
}
 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!