• Dave Durant 1
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 2
    Questions
  • 4
    Replies
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 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. 
<!--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?

 
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!)

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?

 

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!)
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:
<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:
  1. In some cases EmployeeLoginURL is the base URL of our Community instead of our CRM instance
  2. 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;
  3. The login parameter is (indeed) not a valid one.
In some other SF Community, I noticed that in the login screen they have the same fucntionality I am looking for and the displayed link is in the format:
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