-
Notifications
You must be signed in to change notification settings - Fork 410
Allow custom (extra) texter profile fields to be used in scripts #1961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Allow custom (extra) texter profile fields to be used in scripts #1961
Conversation
ffb97cf to
1a1a3c2
Compare
1a1a3c2 to
60dac53
Compare
|
I don't have time right now to test this thoroughly, but glancing through the code, it seems fine to me. My one question is do we actually need the |
|
@jeffm2001 I can't either but implemented it this way with the spirit of disrupting others as little as possible, so for most folks they wouldn't see any change unless they choose to (of course this time other than the breaking change regarding var name / I was also considering adding another key to the fields themselves, like |
schuyler1d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ let's remove the environmental variable -- I appreciate the care to avoid disrupting folks, but this has no backwards-incompatible implications so we don't need one.
We only need new variables if it would break previous things (e.g. if you were changing or removing the availability of those script choices).
schuyler1d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
schuyler1d
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this was backwards incompatible -- I would like to avoid that.
Further with a bit extra scrutiny I don't think the cacheable campaign thing needs to be included.
| customFields = Object.keys(JSON.parse(firstContact.custom_fields)); | ||
| } | ||
| return []; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this part necessary? This is caching the field list to be sent about the contact -- I don't think we need this at all as these are texter fields, not contact fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crayolakat to answer @schuyler1d's question here, this is necessary because it's grabbing the existing contact custom fields to be merged with the texter fields to be cached on the campaign, allowing them to be used in scripts.
see this line:
https://github.com/MoveOnOrg/Spoke/pull/1961/files#diff-612db26be6b7f5a0cdd54b604ffa5d5afb3bd8208271fea120755796f1803972R77
679fe5c to
e1e4298
Compare
|
Hi @codygordon , while testing, I am seeing the following error message That message appears when I click into a required field, and then click out without typing anything. Is the error message supposed to say that, or should it say "Zip Code is a required field" similar to what's in the screenshot provided in the description of your PR? |
|
@crayolakat sorry this took so long, I totally missed this and thought it had already been deployed! I fixed the weird validation message, as well as a couple bugs I noticed while re-reviewing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @codygordon !
Another small thing I noticed:
- Create a new user and join an organization. You'll be taken to a page asking you to complete your profile
- Don't fill out any additional fields and click "SAVE"
- Issue: No validation errors appear telling the user they need to fill out required fields
Can we add validation errors at that step?
|
@crayolakat good flag, this wasn't working properly when |


Description
We need to insert custom texter profile fields into scripts which resulted some significant changes to the existing
profile_fieldsimplementation. cc @jeffm2001Pull in this setting from
getConfigso we can use an instance-wide variableFor consistency in variable naming, changed it to
TEXTER_PROFILE_FIELDS, however usingprofile_fieldssetting var name will still work for backwards compatabilityAdded an
isRequiredkey to the profile settings objects – this is really necessary for WFP so users can optionally enter some customized data. For backward compatibility, if legacy extra profile fields are unchanged andisRequiredis not defined, those fields will be treated as if they had"isRequired": trueso expected behavior of existing fields doesn't change. For new fields added,"isRequired": falseshould be added if it is optional.Added a conditional env var calledSCRIPTS_USE_TEXTER_PROFILE_FIELDSthat will make any extra texter profile fields defined inTEXTER_PROFILE_FIELDSpopulate in the script editor. These will show up in the script editor with a prefix oftexter_Example of working

isRequiredvs not fields:Showing up in script editor:

Checklist: