This topic contains 2 replies, has 0 voices, and was last updated by david.smith 8 years, 3 months ago.
-
AuthorPosts
-
July 28, 2016 at 9:43 pm #6275
sklettI’ve just made an attempt to move configuration data that I would normally hardcode (bad!) or store as JSON in a script parameter to a configuration Custom Record. The record defines several Custom Fields that have relationships. What I mean is, the custom record has a couple fields that are List/Record of Field. The problem I have is that when you access those fields from SuiteScript you get the [numerical] internal id with nlobjRecord.getFieldValue() or the field Name with nlobjRecord.getFieldText(). What you don’t get is the SCRIPT id (e.g. ‘custentity_somegreatwonder’). This is bad news because all of the field APIs require the script id, they will not work with internal ids. To be clear: nlobjRecord.setFieldValue(12345, ‘new data’) will not work for a field with internal id 12345; you must use the script id.
Of course I can add a text field to my record and paste the script id there, but that’s lame and brings the whole solution down to a crummy level.
I’ve tried getting a reference to nlobjField w/ the internal id -nope, doesn’t work.
Anyone have any ideas? I was thinking maybe a search with formula results and some magic formula syntax like {custentity_somegreatwonder.scriptid} but that doesn’t work, but I could be doing it wrong.
Any ideas or help appreciated. It’s particularly frustrating because it’s so great to expose the customization objects like this, but if you can’t work with them in code it makes it almost useless. Hopefully I’m just missing something…
This is a cached copy. Click here to see the original post. -
July 29, 2016 at 7:42 am #6276
errolI’m with you. I’ve tried to use that List/Record in the past for a similar situation, but ended up having using a text field to store the field ID (‘custentity_myfield’). In addition to what you are running into trying to pull the ID, I also ran into issues with being able to know which field was which with that List/Record. For example an account may have about 10 fields called ‘Status’ and there is no good way of knowing you are selecting the right one. I’d like to hear what others may have done or do for this.
-
July 29, 2016 at 9:40 am #6277
david.smithCan you provide a little more info? I’m confused what scriptid you’re looking for. Is this on a client script? And why do you need the scriptid to set a field value?
-
AuthorPosts
You must be logged in to reply to this topic.