• avimeir
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 45
    Questions
  • 22
    Replies
Hi all,

I have the following setup:
[Obj1] - [Junction Object] - [Obj2]

And a workflow that fires whenever Junction Object is created or modified, and does a field update from Obj2 to Obj1, field is calle Extra Information.

It works well when adding a junction objet, but doesn't work when the Extra Information field is upated on Obj2 AFTER we have already extablished the junction object. 

Is there a way to refrech the Extra Information field in this case without writing trigger code?

Thanks

Hi All,

I have created a custom VF page that guides a first-time user through the setup of our managed package.

My question is how do I force the user to go to the VF page before using the system, and then make this forced-redirect disappear once they have completed the setup? 

I've seen some hack on this forum from 2009, involving custom homepage component that redirects based on a custom field in the user object, but was wondering if meanwhile there has been a different way to do it?

Thanks

Hi All,

 

Any idea where is the language of Template Source Org for Trialforce determined? 

 

We are creating a new TSO from our TMO, and it gets all the reports, dashboards, in Spanish.

 

Any idea why?

Hi all,

 

I have a managed package with 40 custom objects and arouns 20 VF pages. Right now when users install it, system admins can access all pages, but Salesforce Platform Users can't see some of my VF pages, they get the error:

 

"

Insufficient PrivilegesYou do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary"

 

 

Any idea how I can enable ALL pages and objects quickly for any user?

 

I had a look at the permission sets feature, but unless I am missing something, it seems that I need to go object-by-object and modify each one of them, there must be a better way...

 

Thanks

Hi all,

 

We have an object called Payment__c  and it has a datetime field called Payment_Time__c.

 

A user is asking to create a report and filter the results by the time of the day of Payment_Time__c - only show results if Payment_Time__c > 1/1/2014 10:00 and Payment_Time__c < 1/2/2014 10:00.

 

Is there a way to filter by time of day in reports?

 

I thought of an ugly hack of a forumla field taking the time from the Payment_Time__c field, but I hate this solution. Wanted to use the datetime method format('HH:MM') to create a new forumla field and filter by it, but can't seem to use this method in a formula field.

 

Any ideas?

Hi all,

 

Has anyone experienced weird behavior with Visualforce pages that use jQuery and remoting recently? 

 

We've been banging our heads to the wall in the past week or two with unexpected behavior, code that used to work and now stopped, etc.

 

The issues for us started with a browser expetion "ReferenceError: A4J is not defined", and now many things break daily, and sometimes that start working again the next day, sometimes they just stay broken.

 

We are in touch with the support team at Salesforce, but they don't seem to understand where the problem lies. 

 

Any experience or advice?


We are struggling with a weird and undocumented behavior of Visualforce with Ajax. Here is the description:
 
The problem we face is, that after loading page by $.get(), the AJAX doesn't work properly.

Here is the VisualForce code:

    
  <apex:actionFunction action="{!onShowReservation}" name="showReservation"
          rerender="reservationSteps">
          <apex:param name="selectedRoomId" value="{!selectedRoomId}"
              assignTo="{!selectedRoomId}" />
      </apex:actionFunction>

 



Here is the JavaScript code:

     showReservation(RoomID);

Error we're getting on Firebug:
 "A4J is not a function".


Ugly solution that we've found, and I am not happy about at all:

Adding hardcoded lines to the code
<script src="/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script>
<script src="/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"></script>

 



wil make AJAX work, but other scripts are still out of reach.
 

 

Hi all,

 

I am uploading a release version of our managed package, and then installing it on the trial org.

 

The default language and the user language on our development org is English.

The same for the trial org.

 

But when I install the package, some components are showing in Spainsh. For example, some picklists within Account and Contact.

 

Any idea where this comes from and how I can swtich these to English?

 

Thanks

Hi All,

 

I would like to add a Facebook-like notification feature to our app. The idea is to have a place where we can show how many new "notifications" the user has (like the number inside the red circle on Facebook) , clicking on it will open a list of notifications that are clickable.

 

Before we develop something like this, does anyone know of an existing solution?

 

I looked at the built-in Messages and Alerts feature but it doesn't seem to do the trick, you have to manually go to the Setup area to add notifications, there is no way as far as I see to do this directly from Apex. 

 

I also looked the a notifications bar on AppExcahge, but I dislike the idea of a moving marquee bar, it's not very user friendly, feels "old" design and takes too much screen real estate in my opinion. I am looking for something similar to how Facebook (and many other who followed) solved this issue.

 

Thanks

Hi All,

 

Any idea why would I need the ApexDevNet remote link in a package? Trying to cleanup the components and I'm not sure if this was added by one of our devs or automatically.

 

 

Hi All,

 

Any idea how the optimize the following query? It takes forever to return with high volume of objects

Map<Id, Room__c> rooms            = new Map<Id, Room__c>([SELECT Name, Room_Type__r.Name, Room_Type__r.Id,Cleaning_Status__c,id,                                        (SELECT Rooms__r.Check_In__c,                                                Rooms__r.Check_Out__c ,Rooms__r.Guest_Name__c,Id                                         FROM Reservation__r                                         WHERE Rooms__r.Check_In__c >= :frm                                               OR Rooms__r.Check_Out__c <= :to)                                   FROM Room__c                                   WHERE Name LIKE :('%' + keyword + '%')                                     OR Room_Type__r.Name LIKE :('%' + keyword + '%')]);

 

Hi all,

 

while trying to install a managed package into a new org, I am getting an internal server error. SF support sent me the following error message:

 

 Reservation__c-Reservation Layout: duplicate value found: %3cunknown%3e duplicates value on record with id: %3cunknown%3e: Reservation__c-Reservation Layout: duplicate value found: %3cunknown%3e duplicates value on record with id: %3cunknown%3e

 

Any idea where does the problem lie?

 

 

Hello,

 

I am trying to use fieldsets in a managed app, but get error compiling when I am not explicitly using the namespace.  

Documentation says that we don't need to excplicitly mention the namespace, so am I doing something wrong?

 

String reservationFldsCSV = Util.asCSV(SObjectType.Reservation__c.FieldSets.mynamespace__Reservation_Tab_Table.getFields());

 

 

Thanks

 

 

Hi,

 

I am trying to upload a managed package that we have uploaded in the past. This time I am getting an error (see below). Any idea what could be the solution?

 

 

 

An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 829612027-7385 (714188556) 

Hi all,

 

Any idea how to align two inputField within a <fieldset> on the same line, without using <table> ?

 

 

Hi,

 

How can I get a string representing today's date in the format YYYYMMDD ?

 

Thanks

Hi all,

 

I always found the idea of Views good, but the implementation is far from being user friendly. For example - my users want to filter the custom object Reservation__c by certain properties, and the only way they can do it is by creating a new View. The problem is that the create new view concept and screen is scary for non-tech savyy users.

 

Is there a way to add filters to a tab list view that goes around the need to create new views by the user?

 

For example - allowing to filter by dates, or by status, or by amount paid etc. (all are custom properties of a custom object).

 

One option I thought of is to create a completely new VF page and do this from scratch, but I am trying to avoid re-creating the entire filtering feature.

Hi,

 

I have a controller InvoiceController that does two things:

 

1. initInvoice finds an object of type Invoice__c and stores it in InvoiceController.inv which is defined as 

public static Invoice__c inv {set; get;}

 

 

2. saveInvoice updates the Invoice__c object that we fetched in initInvoice. saveInoice is called when a user clicks a button on the VF page.

 

 

My question is - is there a way to keep the object somewhere between calls? When saveInvoice gets called, the  InvoiceController.inv is null , and I'd like it to be what we've loaded in initInvoice

Hi

 

This might be a stupid question, but whenever I create a new account I need to customize the tabs shown from scratch, and it takes me a long time. Is there a way to just "clone" a new user and include the tab setttings from an existing user?

 

Thanks

I am creating a report for a custom object called Charge__c, which has lookups into more custom objects.

 

Some of the custom objects show in the lefthand Fields list, and some don't. I've checked and all of the looked-up custom objects are allowed to show in reports.

 

What could be the problem here?

 

Thanks!

Hi All,

 

Any idea where is the language of Template Source Org for Trialforce determined? 

 

We are creating a new TSO from our TMO, and it gets all the reports, dashboards, in Spanish.

 

Any idea why?

Hi all,

 

I have a managed package with 40 custom objects and arouns 20 VF pages. Right now when users install it, system admins can access all pages, but Salesforce Platform Users can't see some of my VF pages, they get the error:

 

"

Insufficient PrivilegesYou do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary"

 

 

Any idea how I can enable ALL pages and objects quickly for any user?

 

I had a look at the permission sets feature, but unless I am missing something, it seems that I need to go object-by-object and modify each one of them, there must be a better way...

 

Thanks

Hi all,

 

We have an object called Payment__c  and it has a datetime field called Payment_Time__c.

 

A user is asking to create a report and filter the results by the time of the day of Payment_Time__c - only show results if Payment_Time__c > 1/1/2014 10:00 and Payment_Time__c < 1/2/2014 10:00.

 

Is there a way to filter by time of day in reports?

 

I thought of an ugly hack of a forumla field taking the time from the Payment_Time__c field, but I hate this solution. Wanted to use the datetime method format('HH:MM') to create a new forumla field and filter by it, but can't seem to use this method in a formula field.

 

Any ideas?

Hi all,

 

Any idea how to align two inputField within a <fieldset> on the same line, without using <table> ?

 

 

Hi,

 

How can I get a string representing today's date in the format YYYYMMDD ?

 

Thanks

Hi all,

 

I always found the idea of Views good, but the implementation is far from being user friendly. For example - my users want to filter the custom object Reservation__c by certain properties, and the only way they can do it is by creating a new View. The problem is that the create new view concept and screen is scary for non-tech savyy users.

 

Is there a way to add filters to a tab list view that goes around the need to create new views by the user?

 

For example - allowing to filter by dates, or by status, or by amount paid etc. (all are custom properties of a custom object).

 

One option I thought of is to create a completely new VF page and do this from scratch, but I am trying to avoid re-creating the entire filtering feature.

Hello,

 

I would like to sum up fields from two different custom objects, no idea how to do it without ugly hacks of converting to decimal. I want to keep the sObject so that I can use it in an apex:outputField as this is a currency field and I need the currency sign.

 

Here's how I get the two sums today. Any idea how to sum both fields into one sObject?

 

Thanks

 

  	    list <AggregateResult> resRooms = [SELECT SUM(Price__c) FROM ReservationRoomAssociation__c WHERE Rooms__c = :getReservationId()];
   		list <AggregateResult> resBeds = [SELECT SUM(Price__c) FROM BedReservationAssociation__c WHERE Reservation__c = :getReservationId()];

 

Hi All,

 

I have a relatedList for a custom object called Invoice__c. I have overridden the View page with a custom VF page, and would like now to open it in a new browser tab when the user clicks on the Invoice item in the related list. Is there a way to make it happen without recreating a custom related list from scratch?

 

Thanks

Hi,

 

I have a custom object called Reservation__c that has a picklist Status__c.

 

I've created a custom button from the detail page that opens a new window to a custom VF page, where the user can change attributes of Reservation__c. On that page, the user can click Save, which does APEX update to the relevant Reservation__c object and window.top.close() to return to the Reservation__c detail page. Once the window is closed, I do a JS refresh of the Reservation__c page to show the changes of the object.

 

The problem is that it takes a few seconds for the change of Status__c to be seen in the Reservation__c page. I suspect that this is due to a delay in the database write backlog. If I wait 2-3 seconds and then manually refresh, the correct changes can be seen. 

 

Any idea on how to solve this issue?  I want the changes to be shown after the automatic refresh, and I want this automatic refresh to be done as soon as the database is updated.

 

Thanks

Hi all,

 

I have an object Services that connects two custom objects using master-detail relationship.

 

I've built a VF page and want to add a related list for this object. How do I do it?

 

Tried 

    <apex:relatedList list="Services" />

 But nothing shows.

 

Thanks

Hi all,

 

I have the following VF page:

 

<apex:page controller="CheckAvailController">

<apex:sectionHeader title="Check Availabilities"/>
<apex:pageblock >
    <apex:form >
        <apex:outputLabel value="From: " for="fromDate"/><apex:inputField id="fromDate" value="{!availFrom.Date__c}" />
        <apex:outputLabel value="To: " for="toDate"/><apex:inputField id="toDate" value="{!availTo.Date__c}" />
        <apex:commandButton action="{!search}" value="Search" />
    </apex:form>
    <apex:pageBlock >
        <apex:pageBlockTable value="{!availabilities}" var="avail">
            <apex:column value="{!avail}" />
        </apex:pageBlockTable>
    </apex:pageBlock>

</apex:pageblock>

</apex:page>

 

And I want to embed this into the details page of the custom Reservation__c object, can't seem to find a way to do it. I tried changing the apex:page tag into:

<apex:page controller="Reservation__c" extensions="CheckAvailController">

 But it doesn't accept Reservation__c as controller.

 

What am I missing?

 

Thanks

Hi all,

 

I am getting the error: 

 

Error:Apex trigger handleReservationChange caused an unexpected exception, contact your administrator: handleReservationChange: System.LimitException: Too many SOQL queries: 101

 

I know that it's wrong to have the SOQL queries inside the for loops, but can't understand how to perform what I need otherwise. Could someone please post a code sample of how I could take the SOQL queries outside of the loops?

 

 

private static void assignPricesToReservation (ReservationRoomAssociation__c assoc)
    {
    	Double todayRate = 0;
		Date currentDay;
		
		System.debug('adding assoc ' + assoc);
		
		// Initialize price
		assoc.Price__c = 0;
		
          
        // Get room type                            
		Room_Type__c rt = [SELECT Name,Number_of_Rooms__c, Default_Rate__c, Id
		 				   FROM Room_Type__c 
		 				   WHERE Id = :assoc.Room_Type__c LIMIT 1];
		System.debug('found roomtype ' + rt);		 
		String roomType = rt.Name;
		System.debug('Room type is ' + roomType);
		
		// Get reservation
		Reservation__c resa = [SELECT Total_Nights__c, Check_In__c, Check_Out__c, Total_Price__c
		 					   FROM Reservation__c 
		 					   WHERE Id = :assoc.Rooms__c LIMIT 1];
	        
        // Add price per night    
		for (Integer i = 0; i < resa.Total_Nights__c; i++)
        {
            currentDay = resa.Check_In__c.addDays(i);          
            System.debug('Date: ' + currentDay);
           
            // Check for availability for the night
            try 
            {      
                Availability__c avail = [SELECT Name, Rooms_Available__c,Room_Type__c 
                                         FROM Availability__c 
                                         WHERE Date__c = :currentDay AND Room_Type__r.Name = :roomType];

                // Yes, there is availability
                if (avail.Rooms_Available__c <= 0)
                {
                	throw new reservationException('No availablity for the selected dates');
                }		
                else
                {
                	// Remove one room from the total available rooms of this date / room-type match
                	avail.Rooms_Available__c -= 1;
                	update avail;
                }	    
		    }
		    catch (Exception e) 
			{
				// No availability record, create one
			    System.debug('no availability record, creating a new one with max rooms ' + rt.Number_of_Rooms__c);
			    Availability__c avail = new Availability__c ();
			    avail.Date__c = currentDay;
			    avail.Rooms_Available__c = rt.Number_of_Rooms__c - 1;
			    avail.Total_Rooms__c = rt.Number_of_Rooms__c;
			    avail.Room_Type__c = rt.Id;
			    insert avail;
			    	    			    
			}
			
			
			try 
            {
			    // Is there a specific rate for this day?
			    Date_Rate__c dateRate = [SELECT Price__c
			    						 FROM Date_Rate__c
			    						 WHERE Date__c = :currentDay
			    						 AND Room_Type__r.Name = :roomType
			    						 ];
				 if (dateRate != null)
				 {
				 	todayRate = dateRate.Price__c;
					System.debug('got date-specific rate for ' + currentDay + ' rt: ' + roomType + ' rate is: ' + todayRate);			 
				 }
			}
			catch (Exception e)
			{
			 	todayRate = rt.Default_Rate__c;    
				System.debug('couldn\'t find specific rate for ' + currentDay + ' using default rate: ' + todayRate);	 	
			}
			
	        // Add the rate for this date and room type   
	        System.debug('adding rate to the total price: ' + todayRate);   
	        assoc.Price__c += todayRate;
	          		
	        if (resa.Total_Price__c != null)
	        {
	        	resa.Total_Price__c += todayRate; 
	        }
	        else
	        {
	        	resa.Total_Price__c = todayRate;
	        } 
		            
        }
	    System.debug('New reservation total price is ' + resa.Total_Price__c);   
	    update resa;   	
    }
    
	private static void calculateReservationPrice (Reservation__c r)
	{
		try 
		{
			Reservation__c resa = [SELECT Total_Price__c FROM Reservation__c WHERE Id = :r.Id];
			resa.Total_Price__c = 0;
			update resa;
		}
		catch (Exception e)
		{
			System.debug('couldn\'t set reservation price to 0');
		}
		
		System.debug('calculating new reservation price');
				
		// Get all room associations for this resa
		List <ReservationRoomAssociation__c> assoc = [SELECT a.Id, a.Room_Type__c, a.Rooms__c
												      FROM ReservationRoomAssociation__c a
												      WHERE a.Rooms__c = :r.Id];
		
		System.debug('updating pricing for ' + r.Name);
		
		for (ReservationRoomAssociation__c a : assoc)
		{
			System.debug('Assigning price for association ' + a);
			assignPricesToReservation(a);
		}
	}
	public static void handleReservationChange(List <Reservation__c> oldResas, 
											   List <Reservation__c> newResas)
    {
    	System.debug('handleReservationChange');
    	
    	
    	Reservation__c oldResa;
    	// Check if reservation changed in length
    	for (Reservation__c r : newResas)
    	{
    		oldResa = null;
    		
    		// get the corresponding old resa
    		System.debug('in reservation iteration loop');
 
    		for (Reservation__c oldR : oldResas)
    		{
    			if (oldR.Id == r.Id)
    			{
    				oldResa = oldR;
    				break;
    			}
    		}
    		if (oldResa == null)
    		{
    			throw new reservationException('can\'t find old reservations');
    		}
    		
    		System.debug('old nights: ' + oldResa.Total_Nights__c + ' new nights: ' + r.Total_Nights__c);
    		
    		if (oldResa.Total_Nights__c != r.Total_Nights__c)
    		{
    			System.debug('calling caluclateReservationPrice for' + r);
    			calculateReservationPrice(r);
    		}
    	}
    	
    	
    }
    

 

Thanks!

 

Hi,

 

I have an object that creates association of two custom objects: Reservation and Room. I am trying to do something when a new association is created. This is the code I have:

 

trigger handleNewRoomResaAssociation on ReservationRoomAssociation__c (after insert) {
    for (ReservationRoomAssociation__c assoc : Trigger.New)
    {
        System.debug(assoc.Room__r.Name);
        
      
    }

}

 

The debug returns null, as if there is no Room__c object associated. What am I doing wrong?

 

Thanks

Hi

 

Is there a way to group a few custome tabs into one drop-down menu?

 

Thanks!

 

Avi

Hi 

 

I am trying to add a birthday to a Client custom object, but the date selector goes only as back as 2011. How can I add all years from 1920 to current year?

 

Thanks

Hi All

 

I am new to Force.com, trying to figure out a way to create a many-to-many relationship of objects.

 

I have two custom objects: Rooms and Reservations. A reservation can have zero or more rooms assigned to it, and a room can be assigned to zero or more reservations.

 

I tried using Master-Detail but it requires a single assignment on one of the objects, instead - I want to have lists on both objects, that can be empty or have more than 1 items.

 

Thanksq

Is there a way to put multiple input fields on the same line of a page?  E.g. LastName and Suffix__c on the same line.

 

Thanks

David

  • September 08, 2009
  • Like
  • 0