UD Form Update Issue

Hi All,

Can anyone help me resolve this issue?

edvUD100.dataView.Table.Rows[0]["CollectionStampDate_c"] = DateTime.Now;
edvUD100.dataView.Table.Rows[0]["CollectionStamp_c"] ((Ice.Core.Session)oTrans.Session).UserName;

It set based on a tick box being checked… It basically updates a DB fields with the information from Date and Username but when ever I reopen the form to look at the stamps… They always say the person who is logged in… E.g If it was filled in with Joe Bloggs (another user) they’ve pressed save… I open the same form and look at the same record. It will say Aaron Gulley in the username box and the date will be today rather than the date when the tick box was ticked.

What the UI says.

What SQL says.

Just out of selecting that record it was ticked today… by the that user but it does it other records which have the date entered being i.e 16/04/2021

What I am doing wrong?

The following code, sets the values to today’s date and current user.

edvUD100.dataView.Table.Rows[0]["CollectionStampDate_c"] = DateTime.Now;
edvUD100.dataView.Table.Rows[0]["CollectionStamp_c"] ((Ice.Core.Session)oTrans.Session).UserName;

You should probably only use that code when doing an Update, otherwise you should simply just EpiBind to CollectionStampDate_c & CollectionStamp_c and nothing more, nothing less.

Even better, the way I would do it is I would set the user and the timestamp in the UD100 BPM so if you have multiple companys and they have their own timezones you could use

Ice.Lib.CompanyTime.Today(); // CurrentCompany Defaulted
Ice.Lib.CompanyTime.Now(); // CurrentCompany Defaulted

In addition it wouldnt matter then if the record is updated via UBAQ, Dashboard or DMT it would trigger your BPM and always keep that audit trail.

PS: On UD tables you can also enable chglog.

1 Like

Hi Haso,

This is only set when the tick box is checked.

The two boxes are only bound to the data fields nothing else. When the form loads they some how show current data but there is nothing in Form Load that causes this.

What’s the BPM code for Username e.g Joe Bloggs rather than jbloggs.

Must be something going on with the if statement that checks the checkbox. Make sure your doing it in an AfterFieldChange event. (dont use checkbox events if you are)


string name = Db.UserFile.Where(u => u.DcdUserID == Session.UserID).Select(x => x.Name).First()