1 Reply Latest reply: Jul 27, 2012 4:15 AM by Vandermaelen NameToUpdate RSS

    How to prevent data to be saved in a field via CSBR?

    Vandermaelen NameToUpdate

      Hi everyone,

       

      I encounter an issue, and I don't seem to be able to find the solution myself.

      So I hope you guys might help you on it.

       

      We use SDE 10.0 (APM).

       

      Little context:

      We use the Change Mgmt module with linked WO's.

      And we automated the Change Status value based on the WO treatment (through Business Rules).

       

      We also made the Change Status field read-only for all non-change managers.

      To be sure the process is being followed.

       

      But... due to refresh issues of the change form, it sometimes happens that a person is handling a WO,

      completes it and then goes back to the change form. Then they save the change... after the BR changed the change status.

      But as the form they see still contains the old value of the change status... it's like resetting it to the old value.

       

      So I'd like to build a mechanism that makes my change status field read-only and more importantly "save forbidden".

       

      I thought I'd found it, but it doesn't work. So if anyone has an idea/comment, fire away !!  ;-)

       

      I made a CSBR that basically looks at your profile. If you're not a change manager, on save of the change form,

      I do a push of the DB value of the "Status description" into the "Status description" field.

       

      How it's coded:

      CSBR on save in module Change

      if

      {MATH,( SELECT [_SMDBA_].[IV_ISCHANGEMANAGER]('{MAGICUSER}') ) MT}   Equals   '0'

      and

      {TR,Status Description}  NotEqual  'Registered'

       

      Populate form on form change

      Put the expression in the field status: {DB,Change,Status Description,"Sequence"= {TR,Sequence} DB}

       

      Works like a charm for existing changes.

      But crashes at the creation of a new one, as the DB lookup in the populate form action is being executed regardless the firing conditions.

      As you can't perform a data lookup on a record that doesn't exists yet... I get an error. And it doesn't work.

       

      Any idea?

       

      Thanks in advance.

       

      Best regards,

       

       

      Pascal