Sign in to follow this  
Followers 0
HazMatt

Recording a timestamp when user edits a record

7 posts in this topic

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=test@email.com&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
Updated URL

Share this post


Link to post
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)?>

Share this post


Link to post
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) ?>

Share this post


Link to post
Share on other sites

I found my solution. :

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

Share this post


Link to post
Share on other sites

So finally what is the scene?? Have you got the solution?? If yes then just close this thread and if not then tell us your problem.

Share this post


Link to post
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…

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Similar Content

    • By SanderS
      I'm having great success with the PHP site assistant aside from one major issue. I'm not able to display images stored in Supercontainer. The code below will return a broken link. If I take the reference link and paste it into any web browser on any computer on any network, the link works fine. What obvious step am I missing?


      <td rowspan="8" class="field_data">
      <?php echo "<img src='http://74.119.147.179:80/SuperContainer/Files/CKD_Files/PDT/2009/1035/90101463440377643/IMG_6944.jpg' title='Error' alt='Error' />";?>
      </td>