You need to sign in to do that
Don't have an account?
Cthulhu4242
accessing the Id of a lookup field as a string, not an object in php
Ok, this one is driving me a little nutty.
I have a custom object one field of which is a lookup to a Contact. I need to be able to insert an Id into this custom field.
Unfortunately, when I get the result from my query:
$query = "SELECT ContactId FROM SelfServiceUser WHERE Id = '$sfid'";
...
return $r->fields->ContactId;
what is returned is of data type Object when what I really want is data type String. When I echo the returned value to the screen, it's the correct id, but the data type is wrong. How do I get the Id as a string?
Any clues would be appreciated.
I have a custom object one field of which is a lookup to a Contact. I need to be able to insert an Id into this custom field.
Unfortunately, when I get the result from my query:
$query = "SELECT ContactId FROM SelfServiceUser WHERE Id = '$sfid'";
...
return $r->fields->ContactId;
what is returned is of data type Object when what I really want is data type String. When I echo the returned value to the screen, it's the correct id, but the data type is wrong. How do I get the Id as a string?
Any clues would be appreciated.
return (string)$r->fields->ContactId;
Code: