Page 1 of 1

Custom fields in event rules

Posted: Tue Aug 04, 2015 6:31 pm
by Reglo
Is it possible to access the value of a custom field in an event rule? The only method I can see is to create a custom variable in Site Admin, then map the custom field to that variable using a Mapper Script, then retrieve the variable in the event rule. However, this is rather convoluted, and probably very inefficient. Is there a better way?

Thanks,
Reglo

RE: Custom fields in event rules

Posted: Wed Aug 05, 2015 7:20 pm
by johan
Please update Patch.v4 from beta.gpsgate.com

exposed .getCustomFieldValue(strLabel) for user objects in Script Expressions

Regards,
Johan

GpsGate Support

RE: Custom fields in event rules

Posted: Wed Aug 05, 2015 7:47 pm
by Reglo
The update failed, with a status message: "Could not get registered plugins: strDestinationRootDirectoryPath can not be null." This error doesn't let me get back to the main plugins page.

Thanks,
Reglo

RE: Custom fields in event rules

Posted: Wed Aug 05, 2015 8:27 pm
by johan
Something has happened to your installation that is not related to this particular update.

Can you reload the page?

If you still have problems, you need to contact support @ gpsgate.com and we will trouble shoot this.

Regards,
Johan

GpsGate Support

RE: Custom fields in event rules

Posted: Thu Aug 13, 2015 7:00 pm
by Reglo
This update is great, it helped me solve the situation described here: topic.asp?TOPIC_ID=18100

I wanted to provide users with the ability to active/deactivate event rules and select notification options, without giving them full access to the event rule wizard. So I created a custom listbox for each rule, and used script expressions to control the rules accordingly.

Thanks,
Reglo

RE: Custom fields in event rules

Posted: Fri Aug 14, 2015 3:21 am
by Alon
Hi Reglo,

Can you share some print screens of what you have done?

Thanks,

Alon

RE: Custom fields in event rules

Posted: Fri Aug 14, 2015 5:18 am
by Reglo
Sure Alon.

This is what appears in the "Edit User" dialog:


Image


Each event category is associated with three separate rules: One for email notification, one for SMS notification, and one for display on map (which is active for all options except "disabled").

Here is an example of the Script Expression used for the latter case:

Code: Select all

var tSpeed = session.user.getCustomFieldValue ('Speeding Alert'); //Alert category type
var limit = session.user.getCustomFieldValue ('Speed Limit (mph)');
var vSpeed = fields.get('Speed', null)*2.23694; //Adjust for mph

if(tSpeed != 'Disabled' && vSpeed > limit) return true;
return false;
Best regards,
Reglo

RE: Custom fields in event rules

Posted: Fri Aug 14, 2015 5:55 am
by Alon
Excellent, really great flexibility for the end user without needing "technical" support in the events panel.
Many thanks!!

RE: Custom fields in event rules

Posted: Fri Aug 14, 2015 6:51 pm
by piter197
Hi Reglo, good sharing.

GGS Support, please post tutorial on blog regarding this case.

Best Regards,
piter197

RE: Custom fields in event rules

Posted: Tue Aug 25, 2015 5:21 pm
by juanjogpsgate
Hi,

we created a new blog entry with a guide about how to set this up.Check it here:

http://gpsgate.com/blogComment/allow_us ... _scripting