Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

getObjectDescription problems with some objects #65

Open
akiraFuk opened this issue Oct 12, 2017 · 8 comments
Open

getObjectDescription problems with some objects #65

akiraFuk opened this issue Oct 12, 2017 · 8 comments

Comments

@akiraFuk
Copy link

I have problems to get some objects descriptions, like 'opportunity and Lead.

ERROR :

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 1, 0

when i search for a reason, i found problem in "xdfDFList <- sapply(xdfList, data.frame)"

i rewrite some codes to work with JSON, just because is easier for me.

@Thomas-Foster
Copy link

I am also having this issue where certain objects throw up this error and others do not. Does anyone have a fix or workaround for it?

Thanks

@ermyuriel
Copy link

I am having the same issue.

Anyone figured it out?

Thanks.

@akiraFuk
Copy link
Author

akiraFuk commented Nov 24, 2017 via email

@Thomas-Foster
Copy link

@akiraFuk can you share the modifications you did to fix the function?

Thanks

@akiraFuk
Copy link
Author

_function(objectName) {

endpointPath <-
objectName %>%
private$zeusApiGetObjectDescriptionEndpoint()

URL <-
private$session_sf['instanceURL'] %>%
paste(endpointPath, sep='')

OAuthString <-
'Bearer' %>%
paste(private$session_sf['sessionID'])

httpHeader <-
httr::add_headers("Authorization"=OAuthString,
"Accept"="application/json",
'Content-Type'="application/json")

res <-
httr::GET(url=URL,
config=httpHeader)

resContent <-
res %>%
httr::content(as='text',
encoding = 'UTF-8')

jsonContent <-
resContent %>%
jsonlite::fromJSON()

df <-
jsonContent$fields

colSelect <- c('name','label','custom','relationshipName','soapType')

df[,colSelect] %>%
return()

}_

I Used this function inside my personal class.

I did few changes in original function. Just work with JSON insted of XML.

@jcress
Copy link

jcress commented Feb 28, 2018

Dropping a +1 here, i'm having the same issue. Not sure how to adapt code from @akiraFuk either. Anyone know how to resolve?

@bradlide
Copy link

bradlide commented Aug 8, 2019

If anyone is still having the issue -
A fix from another thread worked well for me. Credit goes to @BenoitFayolle

Edit the function, replacing the existing definitions for xdfList and xdfDFList.

trace(rforcecom.getObjectDescription, edit = TRUE)

xdfList <- sapply(xdf,xmlToList)
xdfListClean <- sapply(xdfList,
                       function(x){
                         x_clean=x
                         isList=sapply(x,is.list)
                         if(sum(isList)>0)
                           x_clean[which(isList==T)]=sapply(x[which(isList==T)],
                                                            function(y){paste(y,collapse=",")})
                         x_clean
                       })
xdfDFList <- sapply(xdfListClean, data.frame)

@MykolaGolubenko
Copy link

@bradlide thanks for the solution! Perfectly working for me. Many thanks to @BenoitFayolle too.

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

No branches or pull requests

6 participants