Need to validate zapier cli input field with custom values - zapier-cli

I have a list of values and user input should be from my list of custom values. Please check my input field below:
{
key:"timezone",
label: "Timezone",
type: "string",
required: true,
}
I want to validate with "TZ database name" column. Please check below link:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone must be from this above list (TZ database name)
OR
I want custom validation for a input field. Is this possible?

David here, from the Zapier Platform team. Either of those options are possible!
We've got a table in the schema outlining which to use for lists here.
For your use case, you'll have to copy that data into your zap and then use probably FieldChoicesSchema to maintain the order.

Related

Custom data validation when import csv file in REDCap

Is there a way to create a customized validator to validate the data that is imported from csv file in REDCap?
I'm not entirely sure what you mean but I will try to answer your question as best as possible.
To begin with, you can customize what validation is used on a per-field level in REDCap, by simply editing a field and selecting a field type. E. g. if it's a 'text' field with the 'integer' constraint activated, data for that field in uploaded .csv files will be checked to ensure that only integer values are imported. You can add some extra constraints as well, using e. g. min/max values or action tags (link to PDF document about action tags). Note that if you use 'multiple choice'/'checkboxes' type fields, where you manually specify a limited number of possible field choices, uploaded data will be checked to make sure that all values for the field are in the list of allowed field choices.
If you mean that you want to bypass REDCap's validation process so that it allows some normally invalid values to be uploaded (say a value of 2.5 for a 'text' field with the 'integer' constraint), I don't think that's possible, and I don't think there's any good reason for wanting to do that. If you want a field to be less 'lax' about validation, then you can change its type to a more general one. So if you have a 'text' field with the 'integer' constraint, you can simply remove the 'integer' constraint and have it be a plain 'text' field. But be careful if you do this. Think about whether you are removing constraints because actually valid data aren't allowed to be uploaded, or if you are trying to upload invalid data that ought to be removed or fixed. If it's the latter you should definitely leave the validation as it is, because then it's doing its job and letting you know what needs to be corrected.
If you want to add additional validation, making it stricter than what REDCap does at the moment, then you can of course change the field types to be more narrow, e. g. adding an 'integer' constraint to a 'text' field, or changing a 'text' field to be a 'multiple choice' field. That's the solution in REDCap. If you want to add additional constraints/validation, that REDCap doesn't support, I think you'll have to pre-process the data before upload. If you want to automate the validation process then you could write a script in R or Python that:
Imports the .csv data (e. g. with read.csv/read_csv)
Filters the data the way you want (e.g. if you want to exclude certain strings that have a pattern to them, you could use R's 'stringr' package or Python's 're' package)
Uploads the data to REDCap using the REDCap API (for R there's the 'redcapAPI' package, and for Python there's the 'PyCap' package)
Note that you would need an API key, which you can ask your institution's REDCap administrators for, if you'd want your script to upload the data directly. You can of course also create a script that, instead of uploading the data directly, produces .csv files for upload.
If you're not very familiar with R, Python or other programming languages/tools that enable you to craft validation scripts it's probably best to work with what REDCap itself offers you.

retrieve a record using Dynamics 365 Web API with empty alternate key

Problem
I'm trying to query records from Dynamics 365 using the Web API where a key attribute is null.
Approach
For testing purposes I created an entity with a string attribute, an integer attribute, and a decimal attribute. I then created an alternate key and put those three attributes in it, making this combination of attributes unique. I then created some records.
Querying the data using the Web API works as expected. I created a record with those values:
{
"my_string_key": "s1",
"my_integer_key": 1,
"my_decimal_key": 1.23
}
And query it like this:
/my_entities(my_string_key='s1',my_integer_key=1,my_decimal_key=1.23)
This returns the desired record.
However I can't get it to work when any of the key fields is empty, it always returns a 400 with message "Bad Request - Error in query syntax". Just for clarification: I purposely created records where one of the key attributes is empty, like this:
{
"my_integer_key": 1,
"my_decimal_key": 1.23
}
{
"my_string_key": "s1",
"my_decimal_key": 1.23
}
{
"my_string_key": "s1",
"my_integer_key": 1
}
Notice how each record is missing one of the key attributes, which effectively leaves it at null.
I tried using =null, =empty, ='', = and =Microsoft.OData.Core.ODataNullValue but nothing works. I tried to query them like this:
/my_entities(my_string_key=null,my_integer_key=1,my_decimal_key=1.23)
/my_entities(my_string_key='s1',my_integer_key=null,my_decimal_key=1.23)
/my_entities(my_string_key='s1',my_integer_key=1,my_decimal_key=null)
I also tried omitting the attribute with null in it, like this:
/my_entities(my_integer_key=1,my_decimal_key=1.23)
/my_entities(my_string_key='s1',my_decimal_key=1.23)
/my_entities(my_string_key='s1',my_integer_key=1)
None of this works. Can anyone provide a solution?
Final Words
I know that key attributes shouldn't be empty because that's not the point of key attributes. My scenario however requires to handle this specific case.
I also know that I could just use the $filter parameter, but I'd like a solution without having to resort to this "workaround". After all, it is a key and I'd like to treat it as one.
I think your efforts prove that key attributes cannot be empty. So, time for another approach.
Create a custom attribute and fill it with the combined values of the three key attributes. You can do this in a plugin registered in the pre operation stage of the Create and eventually Update messages of your entity.
Use the custom attribute as the key attribute.

Can i make a field editable for a specefic role "System Administrator" if the field type is calculated in the form

I am using a calculated field in a form (Data Type = Single Line of Text), however I would like to make this field editable for a specific users having "System Administrator" roles.
I tried using the field security profile to make this field editable (so that System Admin can update or create records here) however update/create options are disabled here in security profile and cannot be altered.
Is there an appropriate way to achieve this? Can we make a calculated field editable for specific set of roles?
No, you cannot directly edit the value of a calculated field.
A work-around would be to create a separate field, where only specific users can enter data. In your calculated field you could then add a condition to take either the manually entered value from the other field (if it exists) and otherwise use the original action for the calculated field.
The calculated field is calculated in SQL when you retrieve it, but is not stored in field.
So, for a calculated field there IS NOT a place to store a value. This makes it impossible to have the same field be calculated in some cases and manual in other cases.
You would need to have two fields the calculated fields and an override field. In the calculated field you set a condition that if the override field contains data the action is to set the calculated field equal to the override field. The else has an action to calculate the field as your normally.
Here is an example where I created a field testca(`new_testca') that will if the Account Number is populated use that value and if not its value will be some text I entered, "NEED ACCOUNT NUMBER".

jqGrid sorting not working when i use field name as field_name

I am using jqGrid 4.3.1. My problem is sorting column in grid using name as item-id does not work.
$col["name"] = "item-id";
But if I use like this, sorting column in grid works fine.
$col["name"] = "itemid";
If i use "-" or "_" in field name sorting doesn't work. Please help
I recommend you don't use any special charackters in name value. You don't posted enough details about the grid which you creates, so I try to guess. If you loads the data from the server and you use repeatitems: false style (named properties for the data which represents rows) then you can use jsonmap with the name used on the server and use another name for columns:
name: "itemid", jsonmap: "item-id"
If you use server side sorting (without loadonce: true) then you can use index which corresponds server names, but use another name value:
name: "itemid", index: "item-id"
If your problem exist in your server code only then you could try to enclose special characters in [] or "" characters during building SQL statements. The choice between [] or "" depend on the database which you use.

How in ORACLE CRMOD will a field becomes read only when the pick-list is set to some value

In Oracle CRM ON DEMAND we have the “Status” dropdown field with value as “Completed” in Activities. I have Configure it in a such a way so that the Subject field becomes read only when the status is set to Completed.How to do that.
I found the answer its by using Field Validation by writing Expression.To make Subject Field Read-Only when Status is set to Completed, follow these steps:
GOTO.Admin>Application Customisation>Activity>Activity Field Set UP.
Click Subject and in Field Validation box,
write the following expression
PRE('') = [] OR NOT []=LookupValue("EVENT_STATUS", "Completed")
save it to see required result

Resources