thong127

Script is not working to my invoice layout

Discussion created by thong127 on Nov 16, 2016
Latest reply on Nov 16, 2016 by thong127

I Have the following script that I want to used to delete my materials and invoices;

My problem is when Im in my Invoice Layout (List View) when I click the delete, it delete all my records.

 

Set Error Capture [On]

If (Get (Scriptparameter) = "Delete Materials"

Perform Find [Restore] (Materials::Checkbox  ==1)

If [Get ( LastError ) ≠ 0]

Show All Records

Set Error Capture [Off]

Exit Script [Text Result: ]

End If

End If

Set Error Capture [Off]

 

Show Custom Dialog "Delete Materials ** WARNING **"

"Deleting these materials will IRREVERSIBLY REMOVE all their related records. You should ensure that you have backup  elsewhere.

 

If [Get ( LastMessageChoice ) = 1]

Go to Record/Request/Page [First]

Loop

Delete Record/Request [With dialog:off]\

Exit Loop if [Get ( FoundCount ) = 0]

Go to Record/Request/Page [First]

End Loop

End If

Show All Records

 

 

If (Get (Scriptparameter) = "Delete Invoices"

Perform Find [Restore] (Invoices::Checkbox  ==1)

If [Get ( LastError ) ≠ 0]

Show All Records

Set Error Capture [Off]

Exit Script [Text Result: ]

End If

End If

Set Error Capture [Off]

 

Show Custom Dialog "Delete Invoices ** WARNING **"

"Deleting these Invoices will IRREVERSIBLY REMOVE all their related records. You should ensure that you have backup  elsewhere.

 

If [Get ( LastMessageChoice ) = 1]

Go to Record/Request/Page [First]

Loop

Delete Record/Request [With dialog:off]\

Exit Loop if [Get ( FoundCount ) = 0]

Go to Record/Request/Page [First]

End Loop

End If

Show All Records

 

Please help me fix the problem.

 

Thank you.

Outcomes