Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Javascript to lookup field value from Case and copy to Service Activity

$
0
0

I'm trying to learn JS and have created a very simple lookup after reviewing relevant blogs but cannot seem to get it to generate an alert to confirm working.

From the Service Activity entity, linked to the Case with a lookup on the regardingobjectid field, I am trying to lookup the contents of a field in the Case called new_traveltimeaverage (whole number, duration), then output via alert to verify.

I'm working from an existing Service Activity record where regardingobjectid contains saved data, but I keep getting an undefined error.  Can anyone see what I've done wrong here?  Thank you.

var avgtravel = new Array();
avgtravel = Xrm.Page.getAttribute("regardingobjectid").getValue();
if (avgtravel !== null) {
var name = lookup[0].name;
var id = lookup[0].id;
var time = lookup[0].new_traveltimeaverage;
}

alert(time);


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>