We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Have to refresh a page multiple times for code to be triggered

Received Response
17
Views
2
Comments
edited Apr 18, 2019 11:35AM in Customer Portal 2 comments

Content

Hi,

I have a widget in a page. The widget, amongst other stuff, creates a new custom object record (or at least it should) on viewing a page with the widget on

Controller

function getData() {
RNCPHP\ConnectAPI::getCurrentContext()->ApplicationContext = "Sort out controlworks";
$ci = get_instance();
$ci->model('custom/digital')->controlworksAudit(strtotime(time()));
... 

Model

public function controlworksAudit($ignore) {
     RNCPHP\ConnectAPI::getCurrentContext()->ApplicationContext = "Do audit";
     $c_id = get_instance()->session->getProfileData("c_id");
     $contact = RNCPHP\Contact::fetch($c_id);
     $co =  new RNCPHP\WMP\object_wmp_main();
     $co->type = 342;
     $co->Contact = $contact;
     $co->save();
     $co->save(RNCPHP\RNObject::SuppressAll);

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!