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

organization() does not return organization info #55

Closed
ghost opened this issue Dec 25, 2017 · 9 comments
Closed

organization() does not return organization info #55

ghost opened this issue Dec 25, 2017 · 9 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Dec 25, 2017

Should the following not work? (a la identity())
first {
salesforce.organization()
}.then {
(org) -> Promise in
if let nameSpacePrefix = org.nameSpacePrefix {
print("using namespaceprefix (nameSpacePrefix)")
}
}

@mike4aday
Copy link
Owner

mike4aday commented Dec 26, 2017

@pbrondum what is the error? Is it a compile-time error? Your then is not returning a Promise so I believe your code will not compile as-is.

@mike4aday mike4aday self-assigned this Dec 26, 2017
@ghost
Copy link
Author

ghost commented Dec 27, 2017 via email

@mike4aday
Copy link
Owner

mike4aday commented Dec 27, 2017

@pbrondum would you post your code, and the results?

Your understanding is largely correct. org() returns the promise of an Organization struct; identity() returns the promise of an Identity struct.

@ghost
Copy link
Author

ghost commented Dec 27, 2017 via email

@mike4aday
Copy link
Owner

@pbrondum is that a compile-time error? The correct property name is Organization.namespacePrefix -- first "p" is lower-case. See Organization.swift

salesforce.organization() calls identity() first in order to get the current user's org ID, and then it retrieves the Organization object for that ID.

@ghost
Copy link
Author

ghost commented Dec 28, 2017 via email

@mike4aday
Copy link
Owner

@pbrondum I will verify shortly. Does your code compile? The property is namespacePrefix (first "p" is lowercase). Also note that it is an optional string, so you probably want to test for nil, rather than for empty string.

@mike4aday
Copy link
Owner

@pbrondum I'm not able to reproduce that; organization() and org() are both returning a Promise<Organization> which is fulfilled correctly. I put a breakpoint on line 730 in the test file, and I do see the expected Organization struct.

@ghost
Copy link
Author

ghost commented Dec 28, 2017 via email

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

No branches or pull requests

1 participant