Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list_metadata fail instead of returning nil or [] #69

Open
RedaBenh opened this issue Apr 15, 2016 · 0 comments
Open

list_metadata fail instead of returning nil or [] #69

RedaBenh opened this issue Apr 15, 2016 · 0 comments

Comments

@RedaBenh
Copy link

RedaBenh commented Apr 15, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant