• _tofu
  • NEWBIE
  • 10 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

This should be easy for whoever has done this before. I have the following block of code:

for(Id errorID : projectErrorIds) {
    trigger.newMap.get(errorID).Project_Stage__c.addError(System.Label.Project_Error);
}

It kicks out the following error: Field expression not allowed for generic SObject

Obviously, I need to cast it for it to work, but I don't know how. Thank you to anyone who can help!

 

  • March 14, 2014
  • Like
  • 0

I created a Force.com trial.

 

I built a new looking application that I want to show people. 

 

When I go to build users with a Salesforce user license I get a message saying, "All of your user licenses are currently in use by active users. Click here to add more licenses."

So, instead I've built users with "Force.com App Subscriber User." However, with that user license, I can't seem to get the users to be able to use my visualforce wizard pages I've built.

 

  1. Is there any work around so I can show my application to people from a user perspective? Perhaps there is with Force.com App Subscriber Users, I'm admittedly not an ace with security.
  2. Is there a way to add Salesforce user licences without upgrading to a paying account?
  • December 16, 2013
  • Like
  • 0

I'm trying to write trigger that updates records specified in a self referenced lookup.

 

My example would be seats in a theatre and their are two self-referenced fields. One lookup for "Seat To Left" and lookup for "Seat To Right." I want to write a trigger that updates the records you're specifying as lookups.

 

User scenario would be something like the user is updating 192. The user marks "Seat to the Left" as 191. I want the trigger to go to seat 191 and update it's "Seat to the Right" field as being 192, so the user doesn't have to mess around too much.

 

Really roughly, something like this:

 

trigger SeatTrigger on Seat__c (before insert, before update) {
	
	List<Seat__c> triggerSeatsUpdate = new List<Seat__c>(); 
	
	for (Seat__c triggerSeat : Trigger.new) {
		if(triggerSeat.Seat_To_Left__c != null) {
			Seat__c seatToTheLeft = new Seat__c();  
			seatToTheLeft.Id = triggerSeat.Seat_To_Left__c;
			seatToTheLeft.Seat_To_Right__c = triggerSeat.Id;
			triggerSeatsUpdate.add(SeatToTheLeft); 	
		}
		if(triggerSeat.Seat_To_Right__c != null) {
			Seat__c seatToTheRight = new Seat__c(); 
			seatToTheRight.Id = triggerSeat.Seat_To_Right__c;
			seatToTheRight.Seat_To_Left__c = triggerSeat.Id;
			triggerSeatsUpdate.add(SeatToTheRight);
		}
	}
	
	update triggerSeatsUpdate;

}

 Except using an update this way won't work. I don't think I could just add the records to the trigger.new either. Is there a solution for this problem?

  • December 11, 2013
  • Like
  • 0

This should be easy for whoever has done this before. I have the following block of code:

for(Id errorID : projectErrorIds) {
    trigger.newMap.get(errorID).Project_Stage__c.addError(System.Label.Project_Error);
}

It kicks out the following error: Field expression not allowed for generic SObject

Obviously, I need to cast it for it to work, but I don't know how. Thank you to anyone who can help!

 

  • March 14, 2014
  • Like
  • 0

I created a Force.com trial.

 

I built a new looking application that I want to show people. 

 

When I go to build users with a Salesforce user license I get a message saying, "All of your user licenses are currently in use by active users. Click here to add more licenses."

So, instead I've built users with "Force.com App Subscriber User." However, with that user license, I can't seem to get the users to be able to use my visualforce wizard pages I've built.

 

  1. Is there any work around so I can show my application to people from a user perspective? Perhaps there is with Force.com App Subscriber Users, I'm admittedly not an ace with security.
  2. Is there a way to add Salesforce user licences without upgrading to a paying account?
  • December 16, 2013
  • Like
  • 0