On the layout is not shown new value

Viewing 6 reply threads
  • Author
    Posts
  • May 28, 2023 at 4:43 AM #49487

    Pavel
    Participant

    I use SetFieldValue function for setting some fields. After set value and use SaveAllChanges, new value is not displayed. On console I see new value but in layout not.
    If I change value of field manually, I still see old value on console. Value is change when I close and open file. Any tips?

    May 29, 2023 at 1:19 PM #49496

    Brendan
    Keymaster

    Hi Pavel,

    Try removing that field from your custom layout and drag it back in again.

    Maybe something is messed up with that specific field on your custom layout. Don’t delete the field from the Fields list of course. Just remove it from the custom layout and add it back.

    Thanks,

    Brendan

    May 29, 2023 at 1:19 PM #49497

    Brendan
    Keymaster

    Also, you can have a Script Field just return its data and display it on a custom layout. You don’t have to set another field with the result just to display the result.

    May 30, 2023 at 1:13 PM #49506

    Pavel
    Participant

    Hi Brendan,
    I have this problem generally. Delete and replace field in layout is without effect.
    Maybe I make some stupid mistake. Simply script is here:

    function Fill_Match() {

    var ar_lv_r1_id = ‘fld-19384a3f4f1248ea82b16a9d4eee55e0’;
    var ar_lv_r2_id = ‘fld-68464406010642928be2d4722d5b73fa’;
    var ar_lv_r3_id = ‘fld-a09de8a68b6a4658bb030c677341a670’;
    var ar_hv_r1_id = ‘fld-15db9eb1f8be4797a7f787ee90d40d04’;
    var ar_hv_r2_id = ‘fld-47295e7cae1a46d6935848285ba24c82’;
    var ar_hv_r3_id = ‘fld-37dc77cbaf2941a285c76be51f14fa03’;

    record.setFieldValue(ar_lv_r2_id, ‘XXXX’);
    record.saveAllChanges;
    console.log(record.getFieldValue(ar_lv_r2_id));
    return;

    }

    Fill_Match();

    May 30, 2023 at 3:28 PM #49507

    Daniel Leu
    Participant

    Use either form.saveAllChanges(); or document.saveAllChanges();.

    May 31, 2023 at 6:16 AM #49510

    Pavel
    Participant

    I tried all in the past but without effect

    May 31, 2023 at 7:45 AM #49511

    Daniel Leu
    Participant

    Hmmm… this works for me:

    function Fill_Match() {
    
    var ar_lv_r1_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    var ar_lv_r2_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    var ar_lv_r3_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    var ar_hv_r1_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    var ar_hv_r2_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    var ar_hv_r3_id = 'fld-fceb89a0a96345e18d7f06d4991296a6';
    
    console.log("Before: " + record.getFieldValue(ar_lv_r2_id));
    
    record.setFieldValue(ar_lv_r2_id, 'XXXX');
    document.saveAllChanges();
    console.log("After: " + record.getFieldValue(ar_lv_r2_id));
    return;
    
    }
    
    Fill_Match();

    With the console log:

    5/31/23, 7:44:24 AM / New Form / testing Fill_Match
    Before: XXXXY
    After: XXXX
    
    May 31, 2023 at 11:17 AM #49518

    Brendan
    Keymaster

    As Daniel mentioned, there’s no record.saveAllChanges property or function. Also, without the (), that would be a property and not a function.

Viewing 6 reply threads

You must be logged in to reply to this topic.