RForcecom
RForcecom copied to clipboard
getObjectDescription problems with some objects
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.
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
I am having the same issue.
Anyone figured it out?
Thanks.
I edited the function to use json. Its a little different result, but worth for me
Em 24 de nov de 2017 4:35 PM, "eucj" [email protected] escreveu:
I am having the same issue.
Anyone figured it out?
Thanks.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hiratake55/RForcecom/issues/65#issuecomment-346881006, or mute the thread https://github.com/notifications/unsubscribe-auth/AXjQBrVDrO5_UNY53Dx-2bJzHCRHhqQ3ks5s5wxPgaJpZM4P3hbZ .
@akiraFuk can you share the modifications you did to fix the function?
Thanks
_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.
Dropping a +1 here, i'm having the same issue. Not sure how to adapt code from @akiraFuk either. Anyone know how to resolve?
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)
@bradlide thanks for the solution! Perfectly working for me. Many thanks to @BenoitFayolle too.