Hello everyone - i have a piece of code on Behaviours On Load event to make 2 fields Read Only and to do that i am getting a custom field value.i added logging to see what values are coming to compare with.But in the logs i see the following line [Object Object].
please advise.
Here is the code snippet:
Timestamp: 2024-05-12T12:46:06.750Z CorrelationId: aeb129ce-2e8e-4726-b5d0-17745482c0df Field UUID: 4bab493d-aef2-4b01-b30e-d678126f037c Field Name: customfield_11185,fixVersions Event: On Load Message: The Value of Flag is[object Object] Level: info View: Issue view
It seems that the lockedvalue is an object and not a simple value like a string or number. JavaScript uses the toString()
method to convert objects to strings for concatenation, and the default toString()
method for an object returns [object Object]
.
You need to ensure you are accessing the relevant property of the object that holds the actual value you want to log. To see the structure of the object you can just try to log the lockedvalue.
logger.info("Locked value object:", lockedvalue);
Then you can see the structure and log whichever part is convenient.
I hope it helps!
Tuncay
Hello Tuncay- Thanks for the response.
i made a change in the script to get the value by updating the line like below and it started working.
Before-
const lockedvalue = getFieldById("customfield_11185").getValue()
After-
Appreciate your help!!
Thank You
Rao
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad that it's working now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.