Hi all
I try to write a little javascript (it's one of my first times copying them from some post found in communities) to change visualization of a lookup field, if statecode of opportunity is eq 0.
This under is my java and it's working until the rows in green ... the message appears correctly with correct statecode of opportunity (from parent form).
Then I've inserted the get() to try to retrieve the GUID of the views of my lookup column (and other data found in posts that I read).
Where I'm wrong in this script? (this is for me a learning)
How can I retrieve the GUID of all visualization of my lookup column?
Thanks in advance for any help or suggestion
var formContext = e.getFormContext();
if (StatoOpportunity === 0) {
var strDescrizione = "0";
// Xrm.Navigation.openAlertDialog({ confirmButtonLabel: "Ok", text: " valore - " + strDescrizione, title: "Stato Opportunity = " + StatoOpportunity}, { height: 500, width: 500 }).then(function (success) {console.log("Alert dialog closed");},function (error) {console.log(err.message);});
//
// Getting the value of Case cr07a_categoriaopportunita id
var CategDoc = formContext.getAttribute("cr07a_categoriaopportunita").getValue();
// Getting the GUID of the lookup record
var CategDocId = CategDoc[0].id;
// Getting Name of the lookup record
var CategDocName = CategDoc[0].name;
// Getting Entity Name of the lookup which entity, the lookup record is belonging to.
var CategDocEntityType = CategDoc[0].entityType;
//
Xrm.Navigation.openAlertDialog({ confirmButtonLabel: "Ok", text: " CategDocId - " + CategDocId, title: "CategDoc"}, { height: 500, width: 500 }).then(function (success) {console.log("Alert dialog closed");},function (error) {console.log(err.message);});
}