• kka_zzzsai
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies

This is my Visualforce page

 

<apex:page standardController="Registration__c" extensions="CreateRegistration">
    <flow:interview name="Submit_a_Registration" interview="{!flowRegistration}"  finishlocation="{!FinishURL}" />
</apex:page>

 

I have trying to pick a value from Flow and form a URL.  

 

The controller is like this, 

public without sharing class CreateRegistration{

    public Flow.Interview.Submit_a_Registration flowRegistration {get;set;}
    String RegistrationObjPfix     =    '/' + Registration__c.SObjectType.getDescribe().getKeyPrefix();
    
    
    
    public CreateRegistration(ApexPages.StandardController sc){

    }

    public CreateRegistration(){

    }
    
    public String getRTypeID() {
        if (flowRegistration==null) {
            return '';
        }
        else    {
            System.debug('URL is ---'+ '/e?RecordType=' + flowRegistration.registrationrecordtypeid);    
            return '/e?RecordType=' + flowRegistration.registrationrecordtypeid;
        }
    }

    public pageReference getFinishURL()    {
         
        
        /*
        PageReference pgToFinish = flowRegistration!=null?
                                    new PageReference(RegistrationObjPfix + '/e?RecordType=' + flowRegistration.registrationrecordtypeid)
                                    :new PageReference(RegistrationObjPfix);
        */
        //PageReference pgToFinish =  new PageReference('/' + RegistrationObjPfix + '/e?RecordType=' + getRTypeID());
        PageReference pgToFinish =  new PageReference( RegistrationObjPfix + getRTypeID() );
        pgToFinish.setRedirect(true);
        return pgToFinish;
    }
    

}

 

 

The flow is supposed to do some functionality and pass the correct record type.  

 

When i see the debug log, the RTypeId is empty.  The URL clearly takes me to the record with 

/e?RecordType=

 in the end but fails to bring the recordtypeid.

 

i have tried almost all the permutations and combinations.  

 

Any help on this will be highly appreciated.  

Hi,

I have a great need in enabling Javascript in Service Cloud Console.

For example, I have a javascript in home page component which expand the range of the Calendar for date field. This works fine for Accounts and Contacts in regular Sales console when I enable the home page component in home page layout. However when it goes to SCC everything is in an iframe.

What I'm doing right now is in SCC Account page -> edit page layout -> click Custom Console Components

In Primary Tab Components -> Right Sidebar, I choose Type: Visualforce Page, Visualforce Page: HomePageLoader (this visualforce page is basically load the Home Page in an iframe of the VF page so javascript in Home Page component can make change to the main page. Note: this is a hack since VF page and standard SF page are using different domains)

This works most of the time but doesn't seem to be a good practise. It seems like sometimes run into a concurrency problem and javascripts (home page in the iframe) will never finish loading.

 

Here's the code for HomePageLoader VF page:

<apex:page >
<apex:includeScript value="/support/console/25.0/integration.js"/>
<script type="text/javascript">

(function () {
   setTimeout(function () {
       sforce.console.getEnclosingPrimaryTabId(function (result) {
           var subdomain = '{!URLFOR(JSENCODE($Action.Account.Tab), JSENCODE($ObjectType.Account), null, true)}';
           subdomain = subdomain.substring(0, subdomain.indexOf(".salesforce.com"));
               
           var homePageUrl = subdomain + ".salesforce.com/home/home.jsp?tabId=" + encodeURIComponent(result.id);
           setTimeout(function () { 
               var iframe = "<iframe src='" + homePageUrl + "'></iframe>";
               document.write(iframe);
           }, 50);
       });
   }); 
})();

</script>
</apex:page>
 
Here's the code for my Calendar expander Javascript&colon;
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
var startYear = 1930;
var endYear = 2050;
var optionsString = '';
if (startYear < endYear) {
for (i = startYear; i < endYear + 1; i++) {
optionsString += "<option value=\""+i+"\">" + i
+ "</option>";
}
$('#calYearPicker').html(optionsString); //change calYearPicker in regular sales console

for (j = 0; j < window.top.frames.length; j++) {
                                               //travers thru the frames in SCC and change calYearPicker in SCC
$('#calYearPicker', window.top.frames[j].document)
.html(optionsString);
}

}
});
</script>


Any advise or workaround will be great.

Thanks in advance,
Ricky

  • September 13, 2013
  • Like
  • 0

This is my Visualforce page

 

<apex:page standardController="Registration__c" extensions="CreateRegistration">
    <flow:interview name="Submit_a_Registration" interview="{!flowRegistration}"  finishlocation="{!FinishURL}" />
</apex:page>

 

I have trying to pick a value from Flow and form a URL.  

 

The controller is like this, 

public without sharing class CreateRegistration{

    public Flow.Interview.Submit_a_Registration flowRegistration {get;set;}
    String RegistrationObjPfix     =    '/' + Registration__c.SObjectType.getDescribe().getKeyPrefix();
    
    
    
    public CreateRegistration(ApexPages.StandardController sc){

    }

    public CreateRegistration(){

    }
    
    public String getRTypeID() {
        if (flowRegistration==null) {
            return '';
        }
        else    {
            System.debug('URL is ---'+ '/e?RecordType=' + flowRegistration.registrationrecordtypeid);    
            return '/e?RecordType=' + flowRegistration.registrationrecordtypeid;
        }
    }

    public pageReference getFinishURL()    {
         
        
        /*
        PageReference pgToFinish = flowRegistration!=null?
                                    new PageReference(RegistrationObjPfix + '/e?RecordType=' + flowRegistration.registrationrecordtypeid)
                                    :new PageReference(RegistrationObjPfix);
        */
        //PageReference pgToFinish =  new PageReference('/' + RegistrationObjPfix + '/e?RecordType=' + getRTypeID());
        PageReference pgToFinish =  new PageReference( RegistrationObjPfix + getRTypeID() );
        pgToFinish.setRedirect(true);
        return pgToFinish;
    }
    

}

 

 

The flow is supposed to do some functionality and pass the correct record type.  

 

When i see the debug log, the RTypeId is empty.  The URL clearly takes me to the record with 

/e?RecordType=

 in the end but fails to bring the recordtypeid.

 

i have tried almost all the permutations and combinations.  

 

Any help on this will be highly appreciated.  

Currently there is Sharing based on Record Ownership - Group to Group, Roles to Roles, etc and Criteria Based Sharing with a Group or Role.

 

Is it possible to have Sharing based on Record Ownership AND criteria?  Example:  I want to share all records between my group and another except those that are checked as employee (private).

Hi all. 

 

I am working on customizing the quote object to better serve our business needs.  I've added some custom fields to the QuoteLineItem object, Maximum_Volume__c, Minimum_Quantity__c, and Expiration_Date__c.  Each line item will have a value in only one of these fields, but not necessarily the same field. 

 

I'm defining the rendered value based on a PickList Value and updating the VF page using actionSupport.  The VisualForce page works fine, except when the page posts the values entered in the respective fields are not passed to the controller.  If I force a second action on the page(I pushing a command button that doesn't do anything), the second time the values are passed to the controller so I toyed around a little bit....

 

If I reRender the entire pageBlockSection with my actionSupport method, the values post to the controller as I would expect.  The problems with this is that for each line item, I have to select a values from the picklist and and then all of my input fields are cleared.

 

It seems my issue has something to do with the way I am causing the fields to be rendered, but I don't know how to get around it.  I am using a controller extension, but the page uses the standard getters and setters for the quoteLineItems.

 

I would appreciate any suggestions

 

<apex:page standardController="Quote" extensions="newQuoteExt" recordSetVar="OpportunityLineItems" id="page">
  <apex:sectionHeader title="Quote" subtitle="New Special Pricing Agreement"/> 
  <style type="text/css">
        .exceptionText { font-style:italic; font-weight:bold; color:red;}
  </style>
  <apex:messages styleClass="exceptionText"/>
  
  <apex:form >  
    <apex:pageBlock id="block" >
      <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!Save}"/>
        <apex:commandButton value="Cancel" action="{!Cancel}"/>
         <apex:commandButton value="test" action="{!updateAgreementType}"/>
      </apex:pageBlockButtons>
      
      <apex:pageBlockSection title="Quote Information">
        <apex:inputField value="{!theQuote.Name}"/>
        <apex:inputField value="{!theQuote.Status}"/>
        <apex:outputField value="{!opportunity.Name}"/>
        <apex:outputField value="{!opportunity.Account.Name}"/>
        <apex:inputField value="{!theQuote.Description}"/>
      </apex:pageBlockSection>
      <apex:actionRegion >
      <apex:pageBlockSection title="Customer Information" id="custinfo">
        <apex:inputField value="{!theQuote.ContactId}"  id="contact">
          <apex:actionSupport action="{!updateContact}" event="oncomplete" reRender="custinfo"/>
        </apex:inputField>
        <apex:inputField value="{!theQuote.Phone}" id="phone">
          <apex:actionSupport action="{!updateContact}" event="onchange" reRender="custinfo"/>
        </apex:inputField>
        <apex:inputField value="{!theQuote.Email}" id="email"/>
        <apex:inputField value="{!theQuote.Fax}" id="fax"/>
 

      </apex:pageBlockSection> 
      </apex:actionRegion>
      <apex:pageBlockSection title="Address Information">
        <apex:inputField value="{!theQuote.BillingName}"/>
        <apex:inputField value="{!theQuote.ShippingName}"/>
        <apex:inputField value="{!theQuote.BillingStreet}"/>
        <apex:inputField value="{!theQuote.ShippingStreet}"/>
        <apex:inputField value="{!theQuote.BillingState}"/>
        <apex:inputField value="{!theQuote.ShippingState}"/>
        <apex:inputField value="{!theQuote.BillingPostalCode}"/>
        <apex:inputField value="{!theQuote.ShippingPostalCode}"/>
        <apex:inputField value="{!theQuote.BillingCountry}"/>
        <apex:inputField value="{!theQuote.ShippingCountry}"/>
      
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Product Information" columns="1" id="productsection">
        <apex:pageBlockTable value="{!lineItems}" var="item" columnsWidth="25%,25%,25%">
          
          <apex:column headerValue="Product">
            <apex:outputField value="{!item.PriceBookEntry.ProductCode}"/>
          </apex:column>
          
          <apex:column headerValue="Agreement Type" colspan="2" id="test">
            <apex:dataTable value="{!item}" var="type">
              <apex:column >
               
<!- THIS IS THE AREA GIVING ME TROUBLE -- >
 <apex:actionRegion >
                  <apex:inputField value="{!item.Agreement_Type__c}" required="true">
                    <apex:actionSupport event="onchange" action="{!updateAgreementType}" reRender="test"/>
                  </apex:inputField> 
                </apex:actionRegion>
              </apex:column>
              <apex:column id="test">
              <apex:inputField value="{!item.Maximum_Volume__c}" rendered="{!IF(item.Agreement_Type__c='Maximum Volume',true,false)}" required="{!IF(item.Agreement_Type__c='Maximum Volume',true,false)}" id="max"></apex:inputField> 
              <apex:inputField value="{!item.Minimum_Quanitity__c}" rendered="{!IF(item.Agreement_Type__c='Minimum Quantity',true,false)}" required="{!IF(item.Agreement_Type__c='Minimum Quantity',true,false)}" id="min"> </apex:inputField> 
              <apex:inputField value="{!item.Expiration_Date__c}" rendered="{!IF(item.Agreement_Type__c='Expiration Date',true,false)}" required="{!IF(item.Agreement_Type__c='Expiration Date',true,false)}" id="date">  </apex:inputField>
             
              </apex:column>
            </apex:dataTable>
 
           </apex:column>
<! -- --------------------------------------------- END -->
          <apex:column headerValue="Special Price" >
            <apex:outputField value="{!item.UnitPrice}" id="outPut">
              <apex:inlineEditSupport event="dblclick" />
            </apex:outputField>
          </apex:column>

        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>

   </apex:form>
</apex:page>

 

  • July 13, 2011
  • Like
  • 0

Hi,

 

I've created a one-time scheduled apex, which sends out an email 5 days after a value changes on a custom object.

I get the next error:

System.AsyncException: Based on configured schedule, the given trigger will never fire.

 

My code is the next for scheduler:

 

Datetime plus5 = Datetime.now().addDays(5);
String sched = plus5.second()+' '+plus5.minute()+' '+plus5.hour()+' '+plus5.day()+' '+plus5.month()+' ? '+plus5.year();

schClass sch = new schClass();
System.schedule('Sending follow up mail',sched,sch);

What is the problem?

 

Thank you,

Viktor 

 

This is a frustrating problem to solve because the solution is already there in "native" fields with Lookup filters BUT they don't work for the opportunity.  So here's the problem:

 

On a case object, we have the case creator pick an opportunity for the case to be associated with.  Only opportunites with a flag set are valid to be chosen.  So the user adds the case and selects the chooser (Search lookup) for an opp but AGH, they get the entire list returned and there are squillions.  What I'd like to be able to do is filter the search to only opps with flag ABC set.

 

Now, Lookup filters do exactly this but they are not available on opps (why oh why..).  So...anyone have any ideas of another way I can override the functionality of the search for opps?  Perhaps with some VF or Apex?  I really don't want to over-ride the entire opportunity functionality, just the search...

 

Cheers


Dave

  • March 30, 2011
  • Like
  • 0