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
Comments
@pbrondum what is the error? Is it a compile-time error? Your |
Isn't org() and organization() supposed to return information from the
organization object just like identity does for the user object? Or am I
missing something?
Anyway, I'm trying to get nameSpacePrefix from organization() and it does
not return that info. It returns identity information.
Thanks,
Per
Regards,
Per Jakobsen
Regular mail : perbrondum@gmail.com
Secure Mail: isper@protonmail.com
…On Tue, Dec 26, 2017 at 2:25 PM, Michael Epstein ***@***.***> wrote:
@pbrondum <https://github.com/pbrondum> what is the error? Is it a
compile-time error? Your then is not returning a Promise so I believe the
code will not compile as-is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4tYg-NZX3SbBlQY2Q3Wh0qssgJ3re0ks5tEXJzgaJpZM4RMJWN>
.
|
@pbrondum would you post your code, and the results? Your understanding is largely correct. |
Since it looks like organization() uses identity(), and validates the
userid,
open func organization() -> Promise<Organization> {
return identity().then {
(identity: Identity) -> Promise<Organization> in
self.retrieve(type: "Organization", id: identity.orgID)
}
}
I assumed I should be able to do the following:
first {
// Get namespaceprefix of current user
salesforce.organization()
}.then {
orgInfo -> Promise<QueryResult<AccountData>> in
guard orgInfo.nameSpacePrefix != "" else {
throw WiWoError.generic(code: 100, message: "Can't
determine nameSpacePrefix for user")
}
I get the error: "Value of type 'Organization' has no member
'nameSpacePrefix'"
Regards,
Per Jakobsen
Regular mail : perbrondum@gmail.com
Secure Mail: isper@protonmail.com
…On Tue, Dec 26, 2017 at 10:37 PM, Michael Epstein ***@***.***> wrote:
@pbrondum <https://github.com/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4tYm-ytuqfiwF4OabJ4nlbca0ozlbBks5tEeWcgaJpZM4RMJWN>
.
|
@pbrondum is that a compile-time error? The correct property name is
|
In my code above. if you type orginfo. you get a list of Identity
properties, not organization properties. I don't think organization return
the expected properties.
guard orgInfo.nameSpacePrefix != "" else {
throw WiWoError.generic(code: 100, message: "Can't
determine nameSpacePrefix for user")
}
Regards,
Per Jakobsen
Regular mail : perbrondum@gmail.com
Secure Mail: isper@protonmail.com
…On Wed, Dec 27, 2017 at 9:29 AM, Michael Epstein ***@***.***> wrote:
@pbrondum <https://github.com/pbrondum> is that a compile-time error? The
correct property name is Organization.namespacePrefix -- first "p" is
lower-case. See Organization.swift
<https://github.com/mike4aday/SwiftlySalesforce/blob/master/SwiftlySalesforce/Classes/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4tYqszS5eSM2R9x6AKMNiF8B07cjGaks5tEn5jgaJpZM4RMJWN>
.
|
@pbrondum I will verify shortly. Does your code compile? The property is |
@pbrondum I'm not able to reproduce that; |
Ok - error must be on my side then. I'll try again tomorrow. Thanks for
looking into this.
Per
Regards,
Per Jakobsen
Regular mail : perbrondum@gmail.com
Secure Mail: isper@protonmail.com
…On Wed, Dec 27, 2017 at 9:14 PM, Michael Epstein ***@***.***> wrote:
@pbrondum <https://github.com/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
<https://github.com/mike4aday/SwiftlySalesforce/blob/aa4bebaf972deb6f7ff935925d81ad92c79d8e3f/Example/Tests/SalesforceTests.swift#L730>,
and I do see the expected Organization struct.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#55 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4tYvuFh3h3DhyKHN1yO6moUJMK4zS_ks5tEyPAgaJpZM4RMJWN>
.
|
Should the following not work? (a la identity())
first {
salesforce.organization()
}.then {
(org) -> Promise in
if let nameSpacePrefix = org.nameSpacePrefix {
print("using namespaceprefix (nameSpacePrefix)")
}
}
The text was updated successfully, but these errors were encountered: