SmarTeam script returned an error but it still added a record while using an integration?

Scenario:

Created a SmarTeam script that runs before an add. The script checks for duplicated part numbers. If a duplicate is found prompt the user notifying them of the duplicate and return an error from the script to prevent the duplicate from being added.

Testing:

SmarTeam Client Application:

   Create new item which is a duplicate of an existing item.

    Click Save, which fires the SmarTeam script.

    Dialog displays notifying item is a duplicate.

    Script returns an error and the save is canceled, thus preventing duplicates in SmarTeam.

 

SmarTeam Solidworks Integration:

    Create new Solidworks item.

    Save document into SmarTeam so that it is a duplicate of an existing item.

    SmarTeam script fires

     Dialog displays notifying item is a duplicate.

    Script returns an error and the item is saved to SmarTeam. Wait a minute that isn't right

 

Resolution:

    SmarTeam has a configuration setting for each integration called CancelAddOnError. By default this setting is NO, which will not cancel the add to SmarTeam on an error.

After changing CancelAddOnError setting to YES and retesting:

    Create new Solidworks item.

    Save document into SmarTeam so that it is a duplicate of an existing item.

    SmarTeam script fires

     Dialog displays notifying item is a duplicate.

    Script returns an error and the item is not saved to SmarTeam. Now that's more like it.

 

 

 

 

 

Leave a Reply