Checking or compiling fields with Update Title Block trigger
Hi,
these are my cases:
1. A user is compiling fields on an item and I want to check if he has filled one of the fields; I check it with a PX and an Update Title Block trigger. The problem is that it checks the fields before applying the modifications by the user. This way it checks the previous value of the field and not the one inserted by the user. Is it possible to let it save the value and then check it?
2. A user is compiling (for example) two numeric fields on an item and with a PX I go compiling a third field with their sum. Using an Update Title Block trigger it doesn’t allow me to Save, because the fact that I’m writing a third field generates a “The page has been modified” error. How can I bypass this?
Thank you everyone!
Looking at the documentation, You have to work, in a IUpdateEventInfo, on the “Dirty Object” and not directly on the object.
In this way, you can evaluate the values that will be set on the object before set really on it and edit this Map.
private void testIUpdateEventInfo(IAgileSession session, IEventInfo req) throws Exception { IUpdateEventInfo info = (IUpdateEventInfo)req; // get all Event Cells info.getCells(); // get all AttributeIds info.getAttributeIds(); //Get 1st number field info.getValue(CommonConstants.ATT_PAGE_TWO_NUMERIC01); //Get 2ndnumber field info.getValue(CommonConstants.ATT_PAGE_TWO_NUMERIC02); // Add new Dirty value sum. Here you can update the Mpa that will be set on the object so you will not see the "The Page Has been modified" error. info.setCell(CommonConstants.ATT_PAGE_TWO_NUMERIC03, sumOfField1AndField2); // if you want to remove Cell from dirty fields info.removeCell(CommonConstants.ATT_PAGE_THREE_TEXT01); }