Jump to content

Custom Field Values in XML Trouble


ptomter

Recommended Posts

We now getting the values it seems .. from custom fields  - https://whmcs.community/topic/292801-custom-client-fields-values-retrieving/

But when we have this custom in the xml we get  - " Parse error at line [5], column [5]: Extra content at the end of the document "

But if we change this with a value provided by the customer instead ex. 981981981 the the module works perfectly and everything is all good!  So the values retrived is this changed in someway, or added extra information ?! Whmcs Team please provide some insight to this !

 

		";

$clientFields = Client::find($userID)->customFieldValues;

foreach($clientFields AS $field)
{
    
	if (isset($field->customField->fieldName)
		
	and $field->customField->fieldName == "CustomFieldName") 
		    
	{ 	
	
	$xml .=
	
	
	$field->customField->value; // Add ID to XML
			
	
	}	
    
    else
    { 
    return ["error" => "Some Error Message"]; 
    }
}

$xml ="

 

Link to comment
Share on other sites

Hi Steven,

This has been a long week and also another long day. Yes I tried    $xml .="
but then everything beneth this is new xml for WHMCS suddenly and not a continue of previous XML as it should-.

Before "; at top its just xml and this all works, and are correct, and all beneth $xml .="  is correct, its just when using and getting the value from the custom field its not including .. and working

Is this the best way to get custom field?

Link to comment
Share on other sites

And we are sure that this actually getting the value and not just return NULL ?!

 

";
		
	
foreach($clientFields AS $field)
{
    
if (isset($field->customField->fieldName) 
	
and $field->customField->fieldName == "FieldCustomName") 

{ 
    $xml .= $field->customField->value; // Add ID to XML 
}	
    
    else
    {
        return array("error" => "Some Error Message");

    }
}

$xml .="



 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated