I am using the Encrypted Text field to store a user's Social Security or National ID Number. When I enter data into the field, I get the following error message.
Expression evaluation error [evaluation ID = 82d04:b4023] in rule 'pmso_createorupdatespeakerpersonalinfo' at function a!encryptedTextField [line 82]: An error occurred while executing a save: Could not cast from Encrypted Text to Text. Details: CastInvalid.
The SSN is stored as a text field in the Record Type PMSO Speaker. The record is stored as a Local Variable until committed to save by the user.
Here is the code for the field
a!sideBySideItem( item: a!encryptedTextField( label: if( local!isUnitedStates, "Social Security Number", "National Id Number" ), labelPosition: "ABOVE", placeholder:if( local!isUnitedStates, "-- Please enter your Social Security Number --", "-- Please enter your National Id Number --" ), masked: true(), value: local!speakerRecord['recordType!PMSO Speaker.fields.speakerSSN'], saveInto: local!speakerRecord['recordType!PMSO Speaker.fields.speakerSSN'], refreshAfter: "UNFOCUS" ) ),
Discussion posts and replies are publicly visible
Thanks for answering my post.
I created a CDT just to the personal information that I want encrypted. For each of the encrypted fields, they are set to Encrypted Text.
I rewrote my interface to use the new CDT and used the Encrypted Text field. Now I receive the following error message when I type in something to my fields.
Expression evaluation error [evaluation ID = 37dd5:9dfec] in rule 'pmso_createorupdatespeakerpersonalinfo' at function a!encryptedTextField [line 51]: An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'speakerCitizenshipCountry' into type List of Null
Here is the code for the encryptedTextField. All of my fields are set the same and give the same error message.
a!sideBySideItem( item: a!encryptedTextField( label: "Country of Citizenship", labelPosition: "ABOVE", placeholder: "-- Please enter your country of citizenship --", value: local!speakerPrivateInformation.speakerCitizenshipCountry, saveInto: local!speakerPrivateInformation.speakerCitizenshipCountry )
How are you defining the local variable for `local!speakerPrivateInformation`? You have to make sure that local variable is strongly typed by setting it to an initial value. There are restrictions around how you use encrypted text because you can't cast between it and other types, so you have to be explicit on how you define the variables that are used.
In the interface
local!speakerPrivateInformation: rule!PMSO_getSpeakerPrivateInformationbySpeakerId(local!speakerRecord['recordType[PMSO Speaker.fields.speakerId']),
in the expression rule.. It returns null as of now, I have no test data. I need to encrypt the fields, so I need the create. You have to excuse me, I have only been using Appian for about 5 months. How would I cast or type the record or variable?
a!localVariables( local!data: a!queryEntity( entity: cons!PMSO_speakerPrivateInformation, query: a!query( filter: a!queryFilter( field: "speakerId", operator: "=", value: ri!speakerId ), pagingInfo: a!pagingInfo(1, - 1) ), ), if( count(local!data.data) > 0, local!data.data[1], null ) )
Try something like this:
a!localVariables( local!data: a!queryEntity( entity: cons!PMSO_speakerPrivateInformation, query: a!query( filter: a!queryFilter( field: "speakerId", operator: "=", value: ri!speakerId ), pagingInfo: a!pagingInfo(1, 1) ), ).data, cast( 'type!PMSO_Speaker', /* I'm not sure what this is called, but just use your CDT */ local!data ) )
Thank you, but I am still getting an error.
Details: CastInvalidCould not cast from PMSO_speakerPrivateInfo to Number (Integer). Details: CastInvalid
My expression rule.
a!localVariables( local!data: a!queryEntity( entity: cons!PMSO_speakerPrivateInformation, query: a!query( filter: a!queryFilter( field: "speakerId", operator: "=", value: ri!speakerId ), pagingInfo: a!pagingInfo(1, - 1) ), ).data, cast( 'type!{urn:com:appian:types:PMSO}PMSO_speakerPrivateInfo'(), local!data ) )
The error message references line 14
Could you print the variable local!data? I suposse it contains the same fields that you have in the type PMSO_speakerPrivateInfo
The data is null. There is no data in the table. This would also be true for the first time we are adding the personal data for a speaker.
Remove parenthesis when casting
a!localVariables( local!data: a!queryEntity( entity: cons!PMSO_speakerPrivateInformation, query: a!query( filter: a!queryFilter( field: "speakerId", operator: "=", value: ri!speakerId ), pagingInfo: a!pagingInfo(1, - 1) ), ).data, cast( 'type!{urn:com:appian:types:PMSO}PMSO_speakerPrivateInfo', local!data ) )
Now I am getting this error message.
Expression evaluation error: Syntax error. Details: Expression evaluation error at function a!localVariables parameter 2 [line 14]: Unexpected empty parentheses.
I'm sorry. I missing the .data at the end of the local variable.
I got it!!!!! Thanks everyone!!!!
PMSO_speakerPrivateInfo speakerIdnull(Number (Integer)) speakerSSN**********(Encrypted Text) speakerDOB**********(Encrypted Text) speakerCitizenshipCountry**********(Encrypted Text) createdBy""(Text) createdOnnull(Date and Time) modifiedBy""(Text) modifiedOnnull(Date and Time)
Great!!!!! , I was posting again my code