Can a workflow run off a value inserted directly into the database?

Can a workflow run off a value inserted directly into the database? e.g. if i add a date directly into the table outside of suitecrm, can I get a workflow to run in the future based on that date?

No, you’ll need to setup database triggers for that, or you can use webservice that will trigger a workflow

best regards

1 Like

Would something like the below be able to trigger a workflow that fires when shipment_status is changed to delivered? I ask becuase I can’t get the worflow in the attached pic to fire.

$bean = BeanFactory::getBean(‘shi1_Shipping’,$row[‘id’]);
$bean->outbound_tracking_status = $event_status;
if($event_status == ‘Delivered, In/At Mailbox’){
$bean->shipment_status = ‘delivered’;
$bean->inbound_tracking_status = $event_status;

Have you tried updating also the date_modified field with the bean?

I am not sure but possibly thta’s the reason why it doesn’t trigger.

The date seems to modify itself. I have got the workflow to trigger from the script, unfortunately it triggers other workflows that do not meet the conditions as well.

Is the code still the same as the one you shared? And the workflow?

Where did you put your code?
In which files and what code precisely?

I have two scripts in the public_html directory where suitecrm is installed.

test_script2.php - looks like this now:

<?php if(!defined('sugarEntry'))define('sugarEntry', true); require_once('include/entryPoint.php'); $record_id = $_REQUEST['id']; $shipping_bean = BeanFactory::getBean('shi1_Shipping',$record_id); $shipping_bean-> pre_shipment_check = '1'; $shipping_bean->save(); ?>

I also have “test_script2.php” that looks like this:

<?php if(!defined('sugarEntry'))define('sugarEntry', true); require_once('include/entryPoint.php'); $record_id = $_REQUEST['id']; $shipping_bean = BeanFactory::getBean('shi1_Shipping',$record_id); $shipping_bean->shipment_delivered_check = '1'; $shipping_bean->save(); ?>

I call the scripts on records like this from my browser currently:

The check boxes get checked on the front end of the system and everything is good.

I have two workflows:

One is like this:

And one is like this:

The problem is that when either of the scripts are executed, both of the workflows fire resulting in 2 emails. Only one should fire.

It turned out to be some type of issue with the scope of the dropdown menu variables in the workflow.

Please explain in detail how you solved it so that others can also benefit.