You might have a business need to verify the current session's user credentials before certain actions are taken.
This requirement exists for certain industries (such as CFR 21-11 in pharmaceutical industry) to force in some cases an authentication (in order to secure some modifications).
Starting with V11 there is an API developed which can give you this option, below is an example of using ASYRFNC.ACHECKCONNECT
Before we get to the example , you can read more about this API in online help by searching for "Manage user authentication"
So imagine you have a requirement, that every time payment terms is changed in customer function, the user has to enter their Syracuse password to re-verify their identity. Below i how you accomplish this:
- Open Development, Script dictionary , Screens, Screens.
- Select BPC3 screen.
- Click on Fields tab and locate PTE (payment term) field and add a custom control action.
- Save and Validate.
- Open Development, Script Dictionary, Scripts, Script editor.
- Enter SPEBPC and add the following code.
Subprog C_PTE(VALEUR)
Variable Char VALEUR()
Local Integer OK,ASTATUS
Local Char PASS
local Char MSG(200)#Prompt user for Password
#This is a reusable program for prompting for a field
Call SAICAR(PASS,"Enter the signature password","Password","A",0,20,"",OK) From GESECRANIf OK = 2
# this is the call to ASYRFNC.ACHECKCONNECT that checks to find out if the password entered is correct or not
ASTATUS=func ASYRFNC.ACHECKCONNECT(GACTX, PASS,MSG)
If ASTATUS>=[V]CST_AERRORinfbox("You are not allowed to make this change, Your password did not match")
# reverting payment term to the old value
VALEUR =[M:BPC3]PTE
AFFZO [M:BPC3]PTE
Endif
Endif
End - Save and Compile.
- Now open Common Data , BPs, Customers.
- Select an existing customer.
- Click on Financial tab.
- Select a new term for the payment term field.
- After tabbing you will see below, which is a prompt for user to re-enter their Syracuse password.
- If the password is correct, the new payment term is accepted and the focus goes to next field, but if the password entered is incorrect, user will see below and term is reverted back to the old term.
Conclusion: You can use ASYRFNC.ACHECKCONNECT to re-verify users password when certain action happens.