if statement when adding a new record

if statement when adding a new record

  

Morning,

Need an easy answer.

On a typical add and edit form I want to run an if statement on the screen action that recognises if the action is adding a new record. This will then allow me to put some additional logic for when a new record is created, opposed to just editing an existing record.

Within the if statement I have tried the following to capture if it is going to add a new record, of which none of them execute the True state:

ProfileNameId = NullIdentifier()

GetProfileNameById.List.Current.ProfileName.Id = NullIdentifier()

GetProfileNameById.List.Empty

ProfileNameForm.Record.ProfileName.Id = NullIdentifier()

Where ProfileName is the entity name being pulled into the form.

What should my if statement logic be using?

Thanks

Hamish


Pictures:









Solution

Please provide your oml,


but afaik the most easiest way is to check something like this

(out of my head)

<nameOfTheForm>.record.<entity>.Id  = nullidentifier()


that said, imho the specific logic should be in a wrapper of the createorupdate.

so you have 1 place where you do that stuff



Solution

Hello Hamish,

In normal circunstances, ALL the four ways you tried should work for a NORMAL Detail Screen, when you call it passing NullIdentifier() for the Input Parameter on requesting the page.

So, I would say that PROBABLY, the problem is that you are NOT passing a NullIdentifier() to the input parameter of the screen when calling it to create a NEW record...

Cheers

Thank you....returned my if logic back to the record and re-validated it all. Now working.


Hamish