Jump to content

Updating custom field values


mcpacific

Recommended Posts

I'm creating some custom modules that require Custom Fields. I would like to have some fields use default values, supplied via Client's Details, such as:

 

$emailaddress = $params['customfields']['Email Address'];
if (!$emailaddress) $emailaddress = $params['clientsdetails']['email']);

 

However, I think it would be nice for the user to see that these fields could be left blank, and if so, they would be populated with the user's information. This could be done via the "Description" in the Product setup > Custom Fields I suppose, but maybe there's a better way.

 

All this works fine except these default values don't get updated in the table tblcustomfieldsvalues. To do this, a simple update_query seems to be in order, such as:

 

update_query("tblcustomfieldsvalues",array("value"=>$emailaddress),array("fieldid"=>XX,"relid"=>$params['serviceid']));

 

However, this assumes fieldid is known. This will value will be different in each WHMCS database using this module. How would I compose the update query to update a range of custom field values at once?

Link to comment
Share on other sites

  • 7 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated