NoMailing changes made by a Before Save Person trigger are not reflected in the UI after save

lock
push_pin
done
Beantwoord
1

 

Expected:
Changing NoMailing through a Before Save Person trigger should update both the stored data and the UI immediately after saving.

Actual:
Changing NoMailing through a Before Save Person trigger updates the value in the database/backend, but the UI continues to display the previous value until the record is reloaded.

P.S.: I also tried updating the consent information from the same
Before Save Person trigger.

Updating LegalBaseId, LegalBaseKey and LegalBaseName to the
withdrawn values did not change the observed behaviour either.

SuperOffice_noMailing_Recording.zip 
Steps to reproduce:

  1. Create a Before Save Person trigger.
  2. In the trigger, set the following script. maybe change your sTestPersonId:
#setLanguageLevel 4;

String sTestPersonId = "212";

EventData ed = getEventData();

String sPersonId = ed.getInputValue("ActivePersonId");

if (sPersonId != sTestPersonId)
    return;

String sFirstName = ed.getInputValue("PersonEntity.Firstname");
String sLastName = ed.getInputValue("PersonEntity.Lastname");
String sNoMailing = ed.getInputValue("PersonEntity.NoMailing");

// 1. Works with Lastname.
// UI reflects the modified value immediately after Save.
if (!sLastName.endsWith(" Test"))
{
    ed.setOutputValue("PersonEntity.Lastname", sLastName + " Test");
}

// 2. works not with nomailing
// searchagent does reflect the new value aftrer the Person Save
// but the UI does not.
// thus, if someone changes the Entity again in the UI, this gets toggeld again,
// and it becomes a mess really fast
if (sNoMailing == "false")
{
    ed.setOutputValue("PersonEntity.NoMailing", "true");
}
else if (sNoMailing == "true")
{
    ed.setOutputValue("PersonEntity.NoMailing", "false");
}

// But perhaps you'll find another way.

1 u, 55 m geleden | 02:42 p.m.

Alles Antwoorden (1)

Not sure what you use case is here, but NoMailing is an legacy/obsolete field from before consent management was introduced. If you want to change the persons's consent setting you can use the SetConsent function of the PersonAgent in a after save trigger event.

Example;

NSPersonAgent personAgent;

personAgent.SetConsent(personId, "EMARKETING", "USER", "61F", "");
1 u, 38 m geleden | 02:59 p.m.

Reply toevoegen