Hooks that check for unique identifier

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
iclployalty
Posts: 2
Joined: 2016-02-08 13:11

Hooks that check for unique identifier

Post by iclployalty » 2016-02-08 13:24

hi

I am no php developer and taking on the challenge of using AppGini, however
need to be able to do the following for my company campaigns - I will
appreciate any help.

We have a dropdownlist that looks up list of 'campaign name description' each
and every campaign name description has it its own number range. What we would
like to do is so that the hooks looks up what is the next available campaign number
based on the dropdown selection and automatically creates the code after saved.

Example of the list:
ID | Campaign Description | Campaign Abbr.
1 Earn and Spend ES
2 Agile Promo AP
.........
19 Triggered Spend LT

Example 1:
Campaign Description: Earn and Spend - Campaign Abbr. ES and the
number 01. So typically the first one would be ES01, however if ES01 is taken
the next one should be ES02

Example 2:
Campaign Description: Triggered Spend - Campaign Abbr. LT and the
first number should be 01. So typically the first one would be LT01, however
if LT01 is taken the next one should be LT02

In summary:
I have a campaigns table where I want to select a campaign description from a lookup field, and then based on the campaign abbreviation + the code of the last similar campaign, the code field would be populated with the code of the new campaign.

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Hooks that check for unique identifier

Post by grimblefritz » 2016-02-09 13:51

I believe you will need a hook to run after you insert a new campaign, that will query existing campaigns of the same type (ie, start with characters XX where XX is the campaign type) and then parse the number (XX##) and create a new XX(##+1) entry.

You'd also want something to prevent edits once the records are established, otherwise you run into a larger problem of cascading edits. For example, if you change the campaign type from ES to LT, then you have to go find LT entries and make sure the ## is correct, back fill the LT## into the campaign record, and then find the original ES## entries and change them to LT##.

There are a couple of people here who will make hooks for you at a reasonable price. Might be worth consideration.

iclployalty
Posts: 2
Joined: 2016-02-08 13:11

Re: Hooks that check for unique identifier

Post by iclployalty » 2016-02-10 09:35

Thanks for your help. I am no programmer would you be able to show me what example code would look like please

Post Reply