Skip to content

list_metadata fail instead of returning nil or [] #69

@RedaBenh

Description

@RedaBenh

Hi,

In my developper org i have 0 Apex Trigger.


2.1.0 :171 > client.list_metadata( "ApexTrigger")
D, [2016-04-15T18:27:44.615915 #14098] DEBUG -- : SOAP request: https://redabenh-dev-ed.my.salesforce.com/services/Soap/m/26.0/00Vd1000000cJSi
D, [2016-04-15T18:27:44.616004 #14098] DEBUG -- : Cookie: BrowserId=BNmDPaBlSGK_pcKFLoJTfg, SOAPAction: "listMetadata", Content-Type: text/xml;charset=UTF-8, Content-Length: 659
D, [2016-04-15T18:27:44.616034 #14098] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://soap.sforce.com/2006/04/metadata" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://soap.sforce.com/2006/04/metadata"><env:Header><ins0:SessionHeader><ins0:sessionId>XXX</ins0:sessionId></ins0:SessionHeader></env:Header><env:Body><ins0:listMetadata><ins0:queries><ins0:type>ApexTrigger</ins0:type></ins0:queries></ins0:listMetadata></env:Body></env:Envelope>
W, [2016-04-15T18:27:44.616071 #14098]  WARN -- : HTTPI executes HTTP POST using the net_http adapter
D, [2016-04-15T18:27:45.720117 #14098] DEBUG -- : SOAP response (status 200):
D, [2016-04-15T18:27:45.720260 #14098] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata"><soapenv:Body><listMetadataResponse/></soapenv:Body></soapenv:Envelope>
NoMethodError: undefined method `result' for nil:NilClass
    from /Users/redabenh/.rvm/gems/ruby-2.1.0/gems/metaforce-1.1.0/lib/metaforce/abstract_client.rb:55:in `perform_request'
    from /Users/redabenh/.rvm/gems/ruby-2.1.0/gems/metaforce-1.1.0/lib/metaforce/abstract_client.rb:42:in `request'
    from /Users/redabenh/.rvm/gems/ruby-2.1.0/gems/metaforce-1.1.0/lib/metaforce/metadata/client/file.rb:19:in `list_metadata'
    from (irb):171
    from /Users/redabenh/.rvm/rubies/ruby-2.1.0/bin/irb:11:in `<main>'

When i create a trigger and i run the same command the error disappear !

2.1.0 :172 > client.list_metadata( "ApexTrigger")
D, [2016-04-15T18:30:19.691714 #14098] DEBUG -- : SOAP request: https://redabenh-dev-ed.my.salesforce.com/services/Soap/m/26.0/00Vd1000000cJSi
D, [2016-04-15T18:30:19.691833 #14098] DEBUG -- : Cookie: BrowserId=BNmDPaBlSGK_pcKFLoJTfg, SOAPAction: "listMetadata", Content-Type: text/xml;charset=UTF-8, Content-Length: 659
D, [2016-04-15T18:30:19.691864 #14098] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://soap.sforce.com/2006/04/metadata" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="http://soap.sforce.com/2006/04/metadata"><env:Header><ins0:SessionHeader><ins0:sessionId>XXX</ins0:sessionId></ins0:SessionHeader></env:Header><env:Body><ins0:listMetadata><ins0:queries><ins0:type>ApexTrigger</ins0:type></ins0:queries></ins0:listMetadata></env:Body></env:Envelope>
W, [2016-04-15T18:30:19.691904 #14098]  WARN -- : HTTPI executes HTTP POST using the net_http adapter
D, [2016-04-15T18:30:20.714124 #14098] DEBUG -- : SOAP response (status 200):
D, [2016-04-15T18:30:20.714264 #14098] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata"><soapenv:Body><listMetadataResponse><result><createdById>005b0000000vWNJAA2</createdById><createdByName>Reda Benh</createdByName><createdDate>2016-04-15T16:30:01.000Z</createdDate><fileName>triggers/exampleTrigger.trigger</fileName><fullName>exampleTrigger</fullName><id>01qb0000000fzvyAAA</id><lastModifiedById>005b0000000vWNJAA2</lastModifiedById><lastModifiedByName>Reda Benh</lastModifiedByName><lastModifiedDate>2016-04-15T16:30:14.000Z</lastModifiedDate><manageableState>unmanaged</manageableState><type>ApexTrigger</type></result></listMetadataResponse></soapenv:Body></soapenv:Envelope>
 => #<Hashie::Mash created_by_id="005b0000000vWNJAA2" created_by_name="Reda Benh" created_date="2016-04-15T16:30:01.000Z" file_name="triggers/exampleTrigger.trigger" full_name="exampleTrigger" id="01qb0000000fzvyAAA" last_modified_by_id="005b0000000vWNJAA2" last_modified_by_name="Reda Benh" last_modified_date="2016-04-15T16:30:14.000Z" manageable_state="unmanaged" type="ApexTrigger"> 

i can reproduce this error with other empty Metadata Types.

Reda Benh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions