Help needed with hook inserting value using if statement

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Help needed with hook inserting value using if statement

Post by mgain2013 » 2017-02-10 15:33

I am trying to create a hook that will insert a value into a field "district" if another field "store" equals a certain value. Any help would be appreciated. I am assuming this needs to added at the before_insert line..

function waste_reporting_before_insert(&$data, $memberInfo, &$args){
if($data['store'] === "160") $data['district'] = "DST21";
if($data['store'] === "208") $data['district'] = "DST21";
if($data['store'] === "39") $data['district'] = "DST21";
return TRUE;
}

jsinason
Posts: 2
Joined: 2017-02-11 03:16

Re: Help needed with hook inserting value using if statement

Post by jsinason » 2017-02-11 03:18

I actually thing you could accomplish this by using a lookup tablethat has the store number and district in it and using the autofill feature to fill in the district based on the store number entered.

mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Re: Help needed with hook inserting value using if statement

Post by mgain2013 » 2017-02-11 05:54

If it helps, I am using version 5.60...

Post Reply