This message was deleted.
# suitescript
s
This message was deleted.
n
Yeah for sure. Is this object the result of mapContext.value ?
v
yes
n
Alright cool. So you should be doing a JSON.parse(mapContext.value) to get the json string into a usable object. Then its as simple as referencing the key in the object that you want to pull the value from. What specifically are you trying to get out of the object
v
yes you are correct.
i need to get all the values to set the fields of a record.
if you tell for one value like custbody_cseg1.CUSTRECORD_RFS_PACKED_BOX_FULFILLMENT, then i can do others.
n
gotcha. So since your keys have dot notation inside of them, youll have to use brackets to reference them inside the object.
Copy code
let mapValues = JSON.parse(mapContext.value);

let customSegment = mapValues["custbody_cseg1.CUSTRECORD_RFS_PACKED_BOX_FULFILLMENT"].value
v
it says Cannot read property "value" from undefined
n
so thats means something is wrong with our mapValues variable. mapContext is what is being passed in to the map function. so make sure that is named correctly. Sometimes its just context instead of mapContext. Secondly, make sure you are parsing the context.value object before we are trying to pull from it. Then lastly, to debug, log your mapValues object out and make sure the object is getting parsed correctly
c
I'll add that you're asking the same question over & over again, and they're all javascript object accessing questions, and all similar. Please please please try and learn, rather than just cutting and pasting what people tell you. I tried to suggest this last week & you just started a new thread with a slightly different question
💯 1
v
@CD for your information i just dont copy paste the code from here. I tried my level best as a career gap mom after 15 years, its bit difficult and different sometimes than i think, so i come here as the last option. even if you see after i posted here, lot of times i posted that i found the answer and thank you all. Anyways Thank you for your help and the concern. As well please dont judge me that i take the privilege and sympathy because i tell my story.
e
If you're having a bit of difficulty understanding json, you can visualize it using https://jsoncrack.com/editor
But have a look at the MDN article I posted, it goes over everything.