• Thierry JORAND
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
I encountered the following message in debug log :

Class.FlowContact.createCustomer: line 21, column 1 22:43:19.052 (52187112)|FATAL_ERROR|System.UnexpectedException: Illegal arguments

public class FlowContact {
    public class Customer {     
   @InvocableVariable
      public Contact inContact;
    }
   // Response
    public class Response {
      @InvocableVariable
      public String status;
    }
   @InvocableMethod(label='createCustomer' description='Call createCustomer ')     public static List<Response> createCustomer(List<Customer> customers) {         List<Response> resps = new List<Response> ();         Response resp = new Response();         System.debug('createCustomer Contact Id '+customers[0].inContact.Id);

         String strSalutation = customers[0].inContact.Salutation;
        System.debug('createCustomer Contact '+ strSalutation);  // line 21 is here        System.debug('createCustomer Contact fn '+customers[0].inContact.firstName);         System.debug('createCustomer Contact ln'+customers[0].inContact.lastName);         System.debug('createCustomer Contact n'+customers[0].inContact.Name);
        resp.status='0';
        resps.add(resp);
        return resps;
    }
 }

This method is called from a flow with firstname, lastname and Salutation which are fullfilled

Do you have any clue ?
Thanks in advance
Hi,

I have just passed the challenge Using Apex in Components. But i am not satisfied with my solution. Here is it :
Component :
<aura:component controller="DisplayCaseController">
    <aura:attribute name="record" type="Case"/>
    <aura:attribute name="caseId" type="String" default="500F000000XgaGj"/>
    <br/>
    <ui:inputText label="Case Id: " value="{!v.caseId}"/>
    <ui:button label="Get Case" press="{!c.getCase}" />
    <br/>
    <ui:outputText value="{!v.record.Subject}"/>
    <br/>
    <ui:outputTextArea value="{!v.record.Description}"/>
    <br/>
    <ui:outputText value="{!v.record.Status}"/>
    <br/>
</aura:component>

Client Side Controller
({
    getCase : function(component) {
        var action=component.get("c.getCaseFromId");
        action.setParams({"caseID" : component.get("v.caseId")});
        action.setCallback(this, function(a){
            if (a.getState() === "SUCCESS") {
                component.set("v.record",a.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    }
})
The weaknesses are in my opinion :
* if no id or a bad id like 25000 or 0 is given as input then " An internal server error has occurred Error ID: 1632438745-20058 (-467814789)" is displayed.
  The server side component got an exception 15:10:49:826 FATAL_ERROR System.StringException: Invalid id: 25000 or 0
* If the input id is a contact id for example then the apex controller works as expected and returns the '"first" contact.
* I can figure out how to get a case id set to null in the server side controller nor how to validate the id in the client side controller.
Could someone give some clue or some reference to improve this solution ?
Thanks in advance

 

Error: Failed to parse wsdl: Parse error: Found invalid XML. could not determine namespace bound to element prefix wsdl (position: START_DOCUMENT seen ... name="ParksImplService" targetNamespace="http://parks.services/">... @1:83)

From the trailhed I copy and pasted the code into an xml file verified that there were no extra characters and when I attempted to generate the code I go this error.
<wsdl:definitions name="ParksImplService" targetNamespace="http://parks.services/">
	<wsdl:types>
		<xs:schema elementFormDefault="unqualified" targetNamespace="http://parks.services/" version="1.0">
			<xs:element name="byCountry" type="tns:byCountry"/>
			<xs:element name="byCountryResponse" type="tns:byCountryResponse"/>
			<xs:complexType name="byCountry">
				<xs:sequence>
					<xs:element minOccurs="0" name="arg0" type="xs:string"/>
				</xs:sequence>
			</xs:complexType>
			<xs:complexType name="byCountryResponse">
				<xs:sequence>
					<xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="xs:string"/>
				</xs:sequence>
			</xs:complexType>
		</xs:schema>
	</wsdl:types>
	<wsdl:message name="byCountry">
		<wsdl:part element="tns:byCountry" name="parameters">
		</wsdl:part>
	</wsdl:message>
	<wsdl:message name="byCountryResponse">
		<wsdl:part element="tns:byCountryResponse" name="parameters">
		</wsdl:part>
	</wsdl:message>
	<wsdl:portType name="Parks">
		<wsdl:operation name="byCountry">
			<wsdl:input message="tns:byCountry" name="byCountry">
			</wsdl:input>
			<wsdl:output message="tns:byCountryResponse" name="byCountryResponse">
			</wsdl:output>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="ParksImplServiceSoapBinding" type="tns:Parks">
		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="byCountry">
			<soap:operation soapAction="" style="document"/>
			<wsdl:input name="byCountry">
				<soap:body use="literal"/>
			</wsdl:input>
			<wsdl:output name="byCountryResponse">
				<soap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="ParksImplService">
		<wsdl:port binding="tns:ParksImplServiceSoapBinding" name="ParksImplPort">
			<soap:address location="https://th-apex-soap-service.herokuapp.com/service/parks"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

 
I encountered the following message in debug log :

Class.FlowContact.createCustomer: line 21, column 1 22:43:19.052 (52187112)|FATAL_ERROR|System.UnexpectedException: Illegal arguments

public class FlowContact {
    public class Customer {     
   @InvocableVariable
      public Contact inContact;
    }
   // Response
    public class Response {
      @InvocableVariable
      public String status;
    }
   @InvocableMethod(label='createCustomer' description='Call createCustomer ')     public static List<Response> createCustomer(List<Customer> customers) {         List<Response> resps = new List<Response> ();         Response resp = new Response();         System.debug('createCustomer Contact Id '+customers[0].inContact.Id);

         String strSalutation = customers[0].inContact.Salutation;
        System.debug('createCustomer Contact '+ strSalutation);  // line 21 is here        System.debug('createCustomer Contact fn '+customers[0].inContact.firstName);         System.debug('createCustomer Contact ln'+customers[0].inContact.lastName);         System.debug('createCustomer Contact n'+customers[0].inContact.Name);
        resp.status='0';
        resps.add(resp);
        return resps;
    }
 }

This method is called from a flow with firstname, lastname and Salutation which are fullfilled

Do you have any clue ?
Thanks in advance
Hi,

I have just passed the challenge Using Apex in Components. But i am not satisfied with my solution. Here is it :
Component :
<aura:component controller="DisplayCaseController">
    <aura:attribute name="record" type="Case"/>
    <aura:attribute name="caseId" type="String" default="500F000000XgaGj"/>
    <br/>
    <ui:inputText label="Case Id: " value="{!v.caseId}"/>
    <ui:button label="Get Case" press="{!c.getCase}" />
    <br/>
    <ui:outputText value="{!v.record.Subject}"/>
    <br/>
    <ui:outputTextArea value="{!v.record.Description}"/>
    <br/>
    <ui:outputText value="{!v.record.Status}"/>
    <br/>
</aura:component>

Client Side Controller
({
    getCase : function(component) {
        var action=component.get("c.getCaseFromId");
        action.setParams({"caseID" : component.get("v.caseId")});
        action.setCallback(this, function(a){
            if (a.getState() === "SUCCESS") {
                component.set("v.record",a.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    }
})
The weaknesses are in my opinion :
* if no id or a bad id like 25000 or 0 is given as input then " An internal server error has occurred Error ID: 1632438745-20058 (-467814789)" is displayed.
  The server side component got an exception 15:10:49:826 FATAL_ERROR System.StringException: Invalid id: 25000 or 0
* If the input id is a contact id for example then the apex controller works as expected and returns the '"first" contact.
* I can figure out how to get a case id set to null in the server side controller nor how to validate the id in the client side controller.
Could someone give some clue or some reference to improve this solution ?
Thanks in advance

 
I am having issues saving the following Lightning component as part of the Using Apex in Components:

-Given an existing Apex class that can be found here, create a component that displays the case's subject, description and status.The component must be named 'DisplayCase'.
-The component must refer to the 'DisplayCaseController' Apex class. Copy and paste that class into your Developer Edition using the Developer Console.
-The component must have an attribute named 'record' to hold the Case record.
-The component must display the Subject, Description, and Status values of the 'record' attribute.
-The client-side controller for the component must bind to the 'getCaseFromId' method of the Apex controller to fetch the value of a Case record.
-Note that while the Apex class accepts a null and returns a default case, there are various ways to hand the ID to the controller.



FIELD_INTEGRITY_EXCEPTION
Failed to save undefined: No ATTRIBUTE named label found: Source

Component:
<aura:component Controller="DisplayCaseController">
    <aura:attribute name="record" type="Case[]"/>
    <ui:button label="Get Cases" press="{!c.getCaseFromId}"/>
    <ui:outputText Label="Case Subject:" value="{!case.Subject}"/><br/>
    <ui:outputText Label="Case Description:" value="{!case.Description}"/><br/>
    <ui:outputText Label="Case Status:" value="{!case.Status}"/><br/>
</aura:component>

I'm not sure what the issue is. Help...

Controller:
({
    getCaseFromId: function(component){
        var action = component.get("c.getCases");
        action.setCallback(this, function(a){
        	component.set("v.record", a.getReturnValue());
        });
	 $A.enqueueAction(action);
    }
})