AnsweredAssumed Answered

Get editrecord.php to call user's record?

Question asked by furnk on Mar 12, 2009
Latest reply on Dec 9, 2011 by bvondeylen

Title

Get editrecord.php to call user's record?

Post

I apologize for any cross-posting.

 

I want the editrecord.php file that is installed with site assistant to automatically call the user's record. I have a field named "Web User Id" that equals the $userName or AccountName I could do a find for, but I don't have a clue what php code I would need to execute the find or change the current recid.

Here's the code on the top of editrecord.php, if that helps:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<?php
/**
    * FileMaker PHP Site Assistant Generated File
    */


    
require_once 'fmview.php';
    
require_once 'FileMaker.php';
    
require_once 'error.php';

    $cgi 
= new CGI();
    $cgi
->storeFile();
    $databaseName 
'client';
    $layoutName 
'clientweb';
    $userName 
$cgi->get('userName');
    $passWord 
$cgi->get('passWord');

    $fm 
= & new FileMaker();
    $fm
->setProperty('database'$databaseName);
    $fm
->setProperty('username'$userName);
    $fm
->setProperty('password'$passWord);
    
    ExitOnError
($fm);
    $layout 
$fm->getLayout($layoutName);
    ExitOnError
($layout);

    
// formats for dates and times
    $displayDateFormat = '%m/%d/%Y';
    $displayTimeFormat = '%I:%M %P';
    $displayDateTimeFormat = '%m/%d/%Y %I:%M %P';
    $submitDateOrder = 'mdy';

    $recid = $cgi->get('-recid');
    if (!isset($recid))
        $recid = 1;
    $record = $fm->getRecordById($layoutName, $recid);
    ExitOnError($record);
    
    class EmptyRecord {
        function getRelatedSet($relationName) {
            return array(new EmptyRecord());
        }

        function getField($field, $repetition = 0) {
        }

        function getRecordId() {
        }
    }

 

 











Outcomes