Jump to content

Revert Record if field in portal equals a certain value


This topic is 2891 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello forum. 

What I am (hopefully) trying to accomplish is the following:

A user goes into a portal (Sessions) to enter (create) a new related record.  On the portal row is a field called 'Exercise' tied to a value list of available exercises.  The first line in the value list is "-Add New-".  If the user selects this, they are able to create a new exercise (via magic key).  All of this works fine.

However, if the user selects 'Cancel' in any of the script steps, they are able to later, commit the record with "-Add New-" as an entry in the Exercise field (on the portal). 

I would like to revert the record.

So I tried this script, which doesn't revert the record.  In the Data Viewer Watch tab I see the result "-Add New-", but in the script, it just skips over this step and commits the record.  I noticed the Data Viewer Current Tab shows the first portal record, which means even with the proper portal row field in focus, anything that could cause a commit is losing focus on the field.

The simple script:
 

If [FilterValues (List (SESSIONS::Exercise) ; "-Add New-" )]      
    Revert Record/Request [No dialog]
End If

Any thoughts or help are always appreciated

Thanks

Steve

FM Pro Adv 12

Link to comment
Share on other sites

13 minutes ago, Steve Martino said:

If [FilterValues (List (SESSIONS::Exercise) ; "-Add New-" )]

I believe that needs to be:

If [not IsEmpty ( FilterValues ( List ( SESSIONS::Exercise ) ; "-Add New-" ) )] 

if it's ever to return true. What you have returns either "-Add New-" or an empty string - and none of these will return true when converted to a Boolean.

--
P.S. I haven't followed your process that well - note that Revert Record will revert all uncommitted records.

 

 

 

Link to comment
Share on other sites

This topic is 2891 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.