How to change lookup value using crt.HandleViewModelAttributeChangeRequest
i have 2 look up value for status look up attribute i want to make the status be "Achieved" if the proggress is 100 else will be "not Achieved" i use this code but not work can you help me?
if (request.attributeName === 'PDS_UsrProgress_ws4dy5x') { // or Progress changed
var progress = await request.$context.PDS_UsrProgress_ws4dy5x;
if (progress == 100) {
request.$context.PDS_UsrStatus_qlsxa3e = "Achieved";
} else {
request.$context.PDS_UsrStatus_qlsxa3e =" Not Achieved" ;
}
Like
A lookup’s value is an object with a value (the Id) and displayValue (the text).
You’ll set it using:
request.$context.PDS_UsrStatus_qlsxa3e = { displayValue: "Achieved", value: TheIdHere }
thanks Ryan Farley, i try using only id like this request.$context.PDS_UsrStatus_qlsxa3e = "537a92e0-e2bf-494a-913f-3da91eb62e46", and its worked, you think is okay i just do this or use what you give? what do you think that be the best use?