• Brian Yarsawich
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I'm trying to build an unlocked pacakge that includes a community and am recieveing a bunch of errors in my tests.  The errors are all based on being unable to find a custom profile for community users.

This is the function to create a test user to run tests against in the community.
static User initUser(String userName) {

		User thisUser =
				[SELECT Id, UserRoleId
				FROM User
				WHERE Id = :UserInfo.getUserId()];
		
		Account a = new Account(
				Name = 'Test Account For Cart',
				OwnerId = thisUser.Id
		);

		insert a;

		Contact con = new Contact(
				FirstName = 'Test',
				LastName = 'Name',
				AccountId = a.Id
		);
		User u = new User();
		insert con;
		system.runAs(thisuser) {
			Profile p =
					[SELECT Id
					FROM Profile
					WHERE Name ='Customer Community Login User (TOC)'];

			u = new User(
					Alias = 'testUser',
					LastName = 'Testing',
					UserName = userName,
					ProfileId = p.Id,
					Email = username,
					EmailEncodingKey = 'UTF-8',
					LanguageLocaleKey = 'en_US',
					LocaleSidKey = 'en_US',
					TimeZoneSidKey = 'America/New_York',
					ContactId = con.Id
			);

			insert u;
		}

		return u;
	}
The problem is if i use a custom profile the tests fail on package creation, if i use the standard community profile then I get errors on those users not being able to do anything in salesforce.

I have read that profiles are not allowed in custom unlocked pacakges and I have tried cloning the standard community profile in the tests, but you can't run DML statements on a profile so i can't insert a new profile.

Is there any way to actually test code that uses a community user with a community profile?
 

I've been running into a problem with a component that is ebing created dynamically twice on a parent componet.  It is a search component that I want to be shurnk down into a corner of the screen after the first search has been performed.  To do this, it is removed from the main page on submission and then recreated inside another containter component along with the results and filter components.  So basically

  • Router contains Search. 
  • Search fires, get results back
  • Router destroys old componet, creates results wrapper componet
  • Results Wrapper Componet creates display component, search component and filter component
  • Search component shows up with no lightning inputs, filter and display componets are fine

The problem is that all the lightning inputs inside the search component don't render after it is created.  If I inspect the html after it is created the second time, all I see is:

<lightning-input data-aura-rendered-by="115:183;a"></lightning-input>

If there anything about lightning:input that doesn't allow it to be redrawn isnide another component?

I've set up a program in ruby to automate deploying a code base from git to new sandboxes and then update those sandboxes from our dev branch periodically, but right now I'm running into a strange error. Whenever I do my initla deploy to a fresh sandbox, two new List views are being created, one for All Social Posts and one for All Service Contracts.  They List views in question are both in the the package.xml file and on the objects in the src folder.  The spelling is the same in the object, in the package.xml and on the server.

It used to include ,the Ideas.Last_7_Days lsit view and the All Entitlement lsit views, but I deleted these on the server and they stopped, but these two keep appearing.  Anyone else ever encounter this error?
 
I'm trying to write a custom Rest endpoint for account linking. with an Alexa.  Right now the Alexa account linking will not update the access token for oAuth unless there is an expires_at field.  So I built an API to take the request from Amazon, send it to the salesforce oauth service, take the response from the oauth service, add in an appropriate expires_at time based on how long a session should last and return the xml to Amazon.

If I capture the request from amazon using request bin and then post it to the rest API I built with Postman, then the user is authenticated fine.  If I try to have amazon go directly to amazon then it fails and I can't find out why.  Amazon has no logs showing what it sends or recieves and I cna find no way to get a log from the rest API.  I tried adding a trace flag for the user it is authentication, the guest user for the community site, and on the actual apex class.  Nothing will produce a log for me to see what is actually happening.  I can't find out what if anything is the error.

Is there anyway to just create a debug log for a single apex class.
I am running into a very strange issue with my unit tests.  When I run each test or test class individually they all pass fine.  The problem occurs when I try to run multiple tests at once or a test suite I put together.  I've been using case assignment rules to put new cases into queues and they work fine.  The problem I've found from going through the debug logs is that when more than one test is run at once, the case assignment rules never get called.  Going through the logs I don't even see them mentioned though other custom workflows do get triggered.

Does salesforce skip case assignment rules when running large tests?  If so will this cause a failure for deployment to production and if it will is there a way to make the case assignment rules fire?
I'm trying to write a custom Rest endpoint for account linking. with an Alexa.  Right now the Alexa account linking will not update the access token for oAuth unless there is an expires_at field.  So I built an API to take the request from Amazon, send it to the salesforce oauth service, take the response from the oauth service, add in an appropriate expires_at time based on how long a session should last and return the xml to Amazon.

If I capture the request from amazon using request bin and then post it to the rest API I built with Postman, then the user is authenticated fine.  If I try to have amazon go directly to amazon then it fails and I can't find out why.  Amazon has no logs showing what it sends or recieves and I cna find no way to get a log from the rest API.  I tried adding a trace flag for the user it is authentication, the guest user for the community site, and on the actual apex class.  Nothing will produce a log for me to see what is actually happening.  I can't find out what if anything is the error.

Is there anyway to just create a debug log for a single apex class.
I am running into a very strange issue with my unit tests.  When I run each test or test class individually they all pass fine.  The problem occurs when I try to run multiple tests at once or a test suite I put together.  I've been using case assignment rules to put new cases into queues and they work fine.  The problem I've found from going through the debug logs is that when more than one test is run at once, the case assignment rules never get called.  Going through the logs I don't even see them mentioned though other custom workflows do get triggered.

Does salesforce skip case assignment rules when running large tests?  If so will this cause a failure for deployment to production and if it will is there a way to make the case assignment rules fire?