This topic contains 3 replies, has 0 voices, and was last updated by JacksonP 7 years, 11 months ago.

  • Author
    Posts
  • #1428

    JacksonP

    I’m trying to get a lines value on field changed and for some reason it is grabbing the value prior to the change. So as an example, say I have a field called notes and it already holds the value ‘foo,’ I then change it to ‘test’ but on the fieldChanged script it grabs the value ‘foo’ not ‘test.’ Can anyone explain why this would happen?

    Code:
    function fieldChanged(scriptContext){
    var eventRecord = scriptContext.currentRecord;
    var fieldId = scriptContext.fieldId;

    var lineNum = scriptContext.line;

    var fieldValue = eventRecord.getSublistValue({
    sublistId: ‘custpage_eventsublist’,
    fieldId: fieldId,
    line: lineNum
    });
    This is a cached copy. Click here to see the original post.

  • #1429

    starlingMark

    I think you need to try .getCurrentSublistValue instead of .getSublistValue. So try this:

    Code:
    var fieldValue = eventRecord.getCurrentSublistValue({
    sublistId: ‘custpage_eventsublist’,
    fieldId: fieldId,
    });

  • #1430

    zackb22

    If what starlingMark said does not work. Can you try running the function as post sourcing instead? You could also have an issue with standard vs dynamic.

  • #1431

    JacksonP

    The getCurrentSublistValue solution worked. Thanks starling!

You must be logged in to reply to this topic.