-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
2Likes Given
-
2Questions
-
4Replies
Sharing mobile SDK login token between apps?
Hi,
I’m creating an Android app which is called via an FSL app extension. Native Android with older-but-not-ancient SDK version 7.1.2.
In my app, I need to interact with Salesforce objects through the REST API. Basically, FSL is setup to pass my app some key Ids then my app does some more complicated processing that we can’t do inside FSL.
Is there a way to automatically pick up the context of the user that has logged into FSL? Like, if user X has already logged into FSL, I don’t want my app to force them to login again – I just want make the REST calls as user X. Similar, if X logs out of FSL and user Y logs in, I want to do things as user Y instead without the user having to also logout/login in my app too.
It seems like this should be possible but I’m having a hard time getting it to work..
Any tips would be much appreciated!
Thanks!
I’m creating an Android app which is called via an FSL app extension. Native Android with older-but-not-ancient SDK version 7.1.2.
In my app, I need to interact with Salesforce objects through the REST API. Basically, FSL is setup to pass my app some key Ids then my app does some more complicated processing that we can’t do inside FSL.
Is there a way to automatically pick up the context of the user that has logged into FSL? Like, if user X has already logged into FSL, I don’t want my app to force them to login again – I just want make the REST calls as user X. Similar, if X logs out of FSL and user Y logs in, I want to do things as user Y instead without the user having to also logout/login in my app too.
It seems like this should be possible but I’m having a hard time getting it to work..
Any tips would be much appreciated!
Thanks!
- Dave Durant 1
- September 27, 2019
- Like
- 0
- Continue reading or reply
'Connect Components with Events' module bugs?
I think parts of this one got moved around without updating the content that refers to them.
In particular, it looks the code for and discussion around "handleCreateExpense" got moved to the end of the module but parts in the middle rely on it already having happend. There is a bit that says
[quote]If you went ahead and implemented all of the code we just looked at, you can test it out. Reload your app, and toggle a Reimbursed? checkbox a few times. If you missed a step, you’ll get an error, and you should recheck your work. If you did everything right…hey, wait, the expense changes color to show its Reimbursed? status, just as expected![/quote]
...but it doesn't work because the code that's needed to make it happen are down at the bottom of the module.
There is also...
[quote]
We’ll start with the handleUpdateExpense action handler. Here’s the code, and be sure to put it riiiiiight under the handleCreateExpense action handler.[/quote]
...but, again, handleCreateExpense is later in the module.
In particular, it looks the code for and discussion around "handleCreateExpense" got moved to the end of the module but parts in the middle rely on it already having happend. There is a bit that says
[quote]If you went ahead and implemented all of the code we just looked at, you can test it out. Reload your app, and toggle a Reimbursed? checkbox a few times. If you missed a step, you’ll get an error, and you should recheck your work. If you did everything right…hey, wait, the expense changes color to show its Reimbursed? status, just as expected![/quote]
...but it doesn't work because the code that's needed to make it happen are down at the bottom of the module.
There is also...
[quote]
We’ll start with the handleUpdateExpense action handler. Here’s the code, and be sure to put it riiiiiight under the handleCreateExpense action handler.[/quote]
...but, again, handleCreateExpense is later in the module.
- Dave Durant 1
- November 17, 2016
- Like
- 0
- Continue reading or reply
Lightning Components Basics: Handle Actions with Controllers
<!--campingListItem.cmp--> <aura:component > <aura:attribute name="item" type="Camping_Item__c" required="true"/> <ui:outputText value="{!v.item.Name}" /> <ui:outputCheckbox value="{!v.item.Packed__c}" /> <ui:outputCurrency value="{!v.item.Price__c}" /> <ui:outputNumber value="{!v.item.Quantity__c}" /> <ui:button label="Packed!" press="{!c.packItem}"/> </aura:component>
<!--campingListController.js--> ({ packItem : function(component, event, helper) { var button = event.getSource().get("v.disabled"); component.set("v.item.Packed__c", "true"); component.set(button, "true"); } })What am I doing wrong?
- Tyler Zika
- June 07, 2016
- Like
- 2
- Continue reading or reply
Incorrect Code in "Defining Component Attributes" module?
This code will not compile in the Dev. Console:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<docsample:helloHTML/>
<docsample:helloAttributes whom="component composition"/>
</aura:component>
This code will compile:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<c:helloHTML/>
<c:helloAttributes whom="component composition"/>
</aura:component>
The name space is wrong for the two nested components. (Unless I am completely hallucinating! And I might be - it's Friday!)
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<docsample:helloHTML/>
<docsample:helloAttributes whom="component composition"/>
</aura:component>
This code will compile:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<c:helloHTML/>
<c:helloAttributes whom="component composition"/>
</aura:component>
The name space is wrong for the two nested components. (Unless I am completely hallucinating! And I might be - it's Friday!)
- Greg Diercks
- September 04, 2015
- Like
- 2
- Continue reading or reply
Partner Portal - Can't create user that points to Contact in Apex test
I am trying to create a partner portal user in a unit test., but having terrible difficulties. I understand that I must create a Contact and Account first, ensure the Account is a partner account, then create a user that points to the contact. However, I am unable to create a user that points to a contact.
Contact contact1 = new Contact(LastName = 'TestContact'); Database.insert(contact1); Account account1 = new Account(Name = 'TestAccount'); Database.insert(account1); account1.IsPartner = true; Database.update(account1); Profile profile1 = [Select Id from Profile where name = 'System Administrator']; UserRole userRole1 = new UserRole( PortalType = 'Partner', //PortalRole = 'Test', //Name = 'Test Portal Role', PortalAccountId = account1.Id ); Database.insert(userRole1); User user1 = new User( //IsPortalEnabled = true, // 4) Compiler says Field is not writeable. //ContactId = contact1.Id, // 3) Runtime says Only Portal Users can be associated to a Contact. UserType = 'PowerPartner', // 2) Compiler says field not writeable. UserRoleId = userRole1.Id, Username = System.now().millisecond() + 'test12345@test.com', LastName = 'McTesty', Email = 'test12345@test.com', Alias = 'test123', CommunityNickname = 'test12345', TimeZoneSidKey = 'America/Los_Angeles', LocaleSidKey = 'en_US', EmailEncodingKey = 'UTF-8', ProfileId = profile1.Id, LanguageLocaleKey = 'en_US' ); Database.insert(user1); //user1.IsPartner = true; //user1.IsPortalEnabled = true; //Database.update(user1); //user1.ContactId = contact1.Id; // 1) Runtime says role type must match user type. //Database.update(user1);
Can anyone paste some working code for this? Or maybe I'm making an obvious mistake?
- alex_berg
- July 18, 2012
- Like
- 0
- Continue reading or reply
Incorrect Code in "Defining Component Attributes" module?
This code will not compile in the Dev. Console:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<docsample:helloHTML/>
<docsample:helloAttributes whom="component composition"/>
</aura:component>
This code will compile:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<c:helloHTML/>
<c:helloAttributes whom="component composition"/>
</aura:component>
The name space is wrong for the two nested components. (Unless I am completely hallucinating! And I might be - it's Friday!)
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<docsample:helloHTML/>
<docsample:helloAttributes whom="component composition"/>
</aura:component>
This code will compile:
<!--docsample:nestedComponents-->
<aura:component>
Observe! Components within components!
<c:helloHTML/>
<c:helloAttributes whom="component composition"/>
</aura:component>
The name space is wrong for the two nested components. (Unless I am completely hallucinating! And I might be - it's Friday!)
- Greg Diercks
- September 04, 2015
- Like
- 2
- Continue reading or reply
Community: create direct login link for internal CRM instance users
Hello,
I am currently in the process of overriding the native Community login flow of SalesForce with our own custom-made. The custom login flow for Community users (external to our organization) works fine but of course our internal users, if they want to access the community, cannot use the same flow since they need to go to login.salesforce.com (or any othe rinstance URL such as https://na2.salesforce.com), enter their credentials to login to the CRM org and then access the community from there.
Therefore in the login screen for the Community, besides the form to enter the credentials for Communtiy external users, I would like to add a link that redirects our internal users to the CRM login page and still keeping track of the Community URL they were browsing when they were prompted to login.
In order to achieve this, I added the folliwing span element to the SiteLogin component:
https://na2.salesforce.com/servlet/networks/session/create?site=0DM400000003deffa&refURL=[some ref url]
That correctly redirects internal users to the SF CRM login screen. I guess this link is machine-generated since it works without modification in both sandbox and production instances. How can I programmaticaly create such URL? Thanks
I am currently in the process of overriding the native Community login flow of SalesForce with our own custom-made. The custom login flow for Community users (external to our organization) works fine but of course our internal users, if they want to access the community, cannot use the same flow since they need to go to login.salesforce.com (or any othe rinstance URL such as https://na2.salesforce.com), enter their credentials to login to the CRM org and then access the community from there.
Therefore in the login screen for the Community, besides the form to enter the credentials for Communtiy external users, I would like to add a link that redirects our internal users to the CRM login page and still keeping track of the Community URL they were browsing when they were prompted to login.
In order to achieve this, I added the folliwing span element to the SiteLogin component:
<span>Our internal Employee? Login <a href="{! EmployeeLoginURL }">here</a></span>And in the SiteLoginController (that controls SiteLogin):
global PageReference EmployeeLoginURL { get { String startUrl = System.currentPageReference().getParameters().get('startURL'); String sfBaseUrl = System.URL.getSalesforceBaseUrl().toExternalForm(); return new PageReference(sfBaseUrl + '/login?' + startURL); } }This code does not work for the following reasons:
- In some cases EmployeeLoginURL is the base URL of our Community instead of our CRM instance
- In some cases EmployeeLoginURL is treated as a relative path and added to the root path of the communityand generates a page not found error;
- The login parameter is (indeed) not a valid one.
https://na2.salesforce.com/servlet/networks/session/create?site=0DM400000003deffa&refURL=[some ref url]
That correctly redirects internal users to the SF CRM login screen. I guess this link is machine-generated since it works without modification in both sandbox and production instances. How can I programmaticaly create such URL? Thanks
- Francesco Sciuto
- March 18, 2015
- Like
- 3
- Continue reading or reply