Jump to content
Server Maintenance This Week. ×

Recording a timestamp when user edits a record


This topic is 4942 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm putting together a PHP based solution (largely generated from the FileMaker PHP Site Assistant) to allow customers easy access to their email marketing subscriptions. Here's an example link that the email recipient would click on to unsubscribe:

http://66.173.8.234/fmphp/subscriptions/browserecord.php?-action=browse&-recid=18594&contact_id=18615&[email protected]&campaign=Newsletter

I'd like to record a timestamp when someone updates their subscriptions so I can pull a report in a date period (like between newsletters). The auto-enter modification timestamp works, but it doesn't target a specific field so I can't rely on that. Is there a way to trigger a script when the user hits the "Save" button?

I can post my source code if that would be helpful. Thanks!

Edited by Guest
Updated URL
Link to comment
Share on other sites

<?php

echo '

';

echo 'Debugger Window

';

echo 'Record ID: ' . $recid . '

';

echo 'Contact ID: ' . $contact_id . '

';

echo 'Email Address: ' . $email . '

';

echo 'Campaign: ' . $campaign;

echo '

';

?>

Customer ID:

<?php echo nl2br(storeFieldNames('customer_id', 0, $record, true, 'EDITTEXT', 'number'))?>

Name:

<?php echo nl2br(storeFieldNames('full_name', 0, $record, false, 'EDITTEXT', 'text'))?>

Email Address:

<?php echo nl2br(storeFieldNames('email', 0, $record, true, 'EDITTEXT', 'text'))?>

Monthly Newsletter:

<?php

echo '

if (nl2br( $record->getField('newsletter_subscribed', 0))) { echo ' checked' ; }

echo ' disabled';

?>

Last Updated:

<?php echo displayTimeStamp(storeFieldNames('newsletter_subscription_last_updated', 0, $record, true, 'EDITTEXT', 'timestamp'), $displayDateTimeFormat)?>

Link to comment
Share on other sites

<?php

echo '

';

echo 'Debugger Window

';

echo 'Record ID: ' . $recid . '

';

echo 'Contact ID: ' . $contact_id . '

';

echo 'Email Address: ' . $email . '

';

echo 'Campaign: ' . $campaign;

echo '

';

?>

Customer ID:

<?php echo nl2br( $record->getField('customer_id', 0) ) ?>

Name:

<?php echo nl2br( $record->getField('full_name', 0) )?>

Email Address:

<?php echo nl2br( $record->getField('email', 0) )?>

Monthly Newsletter:

<?php $fieldValue = $record->getField('newsletter_subscribed', 0) ; ?>

<?php getInputChoices("checkbox", $layout->getValueListTwoFields('Checkbox', (isset($master_record)) ? $master_record->getRecordId() : $record->getRecordId()), $fieldValue, getFieldFormName('newsletter_subscribed', 0, $record, true, 'CHECKBOX', 'number'), 'number', $submitDateOrder);?>

Last Updated:

<?php echo displayTimeStamp( $record->getField('newsletter_subscription_last_updated', 0) , $displayDateTimeFormat) ?>

Link to comment
Share on other sites

Well the solution is in the link I posted here, but if you need it spelled out, here's the exact code I used:

//  Record timestamp (http://filemakeraddict.blogspot.com/2009/07/setting-filemaker-timestamp-fields-from.html)

$user_update_request = $fm->newEditCommand($layoutName, $recid);

$user_update_request->setField('subscriptions_last_updated', date("m/d/Y h:i:s A"));

$user_update_result = $user_update_request->execute();

And I'm pretty sure you can't 'close a thread' on FM Forums…

Link to comment
Share on other sites

Nice of you to post the code.

I'm watching Almeda, however, as s/he's posted several times without really offering any input, perhaps in an attempt to "share" the link to her website in her signature.

Link to comment
Share on other sites

This topic is 4942 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.