• Ajay Nagar 7
  • NEWBIE
  • 273 Points
  • Member since 2014
  • Salesforce Developer
  • Netsutra.com


  • Chatter
    Feed
  • 9
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
    Questions
  • 76
    Replies
Where can I post a question about wave analytics?
Hi All,

I have created some flows for quote to order in a free develper org. I want to move these flows to my project sandbox org where development need to happen. Is it possible to migrate the changes from free dev org to sandbox org?

 
Hi,
We were developing a lightning component for a E-veg cart. After the summer release '16 things are not working correctly/ We used modal box using css and javasript. Logic is working fine and we get the results when we debugg but it is not getting displayed on the page. Also It is working after deactivating the latest critical update named 'Enable Lightning LockerService Security ' .
Can somebody tell me the updates of summer release '16 when we use javasript and css on lightning components.

Thank you
  • June 21, 2016
  • Like
  • 0
Hi there,

I'm trying to create some custom buttons that will point at a URL for an external admin interface and pass a user ID over. Currently we are pointing at a dev environment, but in the future we will deploy to live and I want to avoid having to update the URL across all the buttons one by one. Essentially I want to create a custom global variable for the URL so I can change it in one place and have the change replicated across all the cutom buttons. 

I can get the buttons to work with the full URL nd also getting the user ID - http://domain.com/user/{Contact.User_ID__c}/update?sid={!User.Session_ID}&apiendpoint={!API.Partner_Server_URL_50}&userid={!User.Id}

What I want is to have http://domain.com/user/ as the global variable. Howevere when I try to use a cutom label e.g. {!Label.Button_URL}, or try to have the URL as a field that I refference e.g. {User.Button_URL__c} I get a stale session error. Does anyone else have experience of working with URL's as a custom global variable? Any assitance is greatly apprciated! 
Here is my code:

Main Class
public class GetOpptyOwnerMgrEmailHandler{
    
    public List<Id> opptyIds {get;set;}
    public List<Opportunity> allOpptys {get;set;}

    public void getMgrEmail(List<Opportunity> opptys){
        
        /*
         * Set variables
         */
        
        getEligibleOpptys(opptys);
        getAllOpptys(opptyIds);
        updateAllOpptys(allOpptys);
    }
    
    private void getEligibleOpptys(List<Opportunity> opptys){
        
        opptyIds = new List<Id>();
        
        for(Opportunity oppty : opptys){
            
            if(oppty.Managers_Email_Address__c == null){
                opptyIds.add(oppty.Id);
            }
        }
    }
    
    private void getAllOpptys(List<Id> opptyIds){
        
        allOpptys = [SELECT Id,Owner.Manager.Email,Owner.Manager.Id FROM Opportunity WHERE Id IN :opptyIds];
    }
    
    private void updateAllOpptys(List<Opportunity> allOpptys){
        
        for(Opportunity oppty : allOpptys){
            
            oppty.Managers_Email_Address__c = oppty.Owner.Manager.Email;
            update oppty;

            system.debug('------------------> here is oppty.Managers_Email_Address__c value: '+oppty.Managers_Email_Address__c);
        }
    }
}

Test Class
@isTest
public class GetOpptyOwnerMgrEmailHandlerTest {
        
    /*
    * Method to test "GetOpptyOwnerMgrEmail" trigger
    */

    @isTest
    public static void testGetOpptyOwnerMgrEmail(){
        
        /*
         * Create two test Users, one manager, one standard
         */
        
        User mgr = DataFactory.createUserMgr();
        insert mgr;
        User u = DataFactory.createUser(); 
        u.ManagerId = mgr.Id;
        insert u;
        
        System.assertEquals(u.ManagerId,mgr.Id,'The managerId didn\'t set properly');
        
        /*
         * Create test Opportunity
         */
        
        Opportunity opp = DataFactory.createOpp();
        opp.Type = 'New Account';
        opp.StageName = 'Prospecting';
        opp.OwnerId = u.Id;
        opp.Competitors__c = 'SaaS Corporate';
        opp.Current_Vendor__c = 'SaaS Corporate';
        opp.Close_Reason__c = 'Features';
        
        System.RunAs(u){
            
            insert opp;
        
            system.debug('------------------> here is the opp value: '+opp);
            system.debug('------------------> here is opp.Managers_Email_Address__c value: '+opp.Managers_Email_Address__c);

            System.assertEquals(opp.Managers_Email_Address__c,mgr.Email,'The email addresses aren\'t the same');
        }
    }
}

DataFactory Class
public class DataFactory {

    /*
     * Method to create test Standard User
     */
    
    public static User createUser(){
        
        Id proId = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1].Id;
        UserRole ur = createUR();
        insert ur;
        User u = new User(
            alias = 'u1', 
            email = 'testUser@company.com',
            emailencodingkey = 'UTF-8',
            firstname = 'Test',
            lastname='User',
            languagelocalekey = 'en_US',
            localesidkey = 'en_US',
            timezonesidkey = 'America/Los_Angeles',
            profileId = proId,
            isActive = true,
            username = 'testUser@company.com',
            userRoleId = ur.id
        );
        return u;
    }

    /*
     * Method to create test User Manager
     */
    
    public static User createUserMgr(){
        
        Id proId = [SELECT Id FROM Profile WHERE Name = 'Standard User' LIMIT 1].Id;
        UserRole ur = createUR();
        insert ur;
        User u = new User(
            alias = 'uMgr', 
            email = 'testUserMgr@company.com',
            emailencodingkey = 'UTF-8',
            firstname = 'Test',
            lastname='UserMgr',
            languagelocalekey = 'en_US',
            localesidkey = 'en_US',
            timezonesidkey = 'America/Los_Angeles',
            profileId = proId,
            isActive = true,
            username = 'testUserMgr@company.com',
            userRoleId = ur.Id
        );
        return u;
    }

    /*
     * Method to create UserRole
     */
    
    public static UserRole createUR(){
    
        // Method creates a UserRole that will cause the GEO to evaluate to "NA"
        
        UserRole ur = new UserRole();
        ur.Name = 'NA TestRole';
        ur.OpportunityAccessForAccountOwner = 'None';        
        return ur;
    }

    /*
     * Method to create test Opportunity
     */
    
    public static Opportunity createOpp(){
        
        Opportunity opp = new Opportunity();
        opp.Name = 'Test Opportunity';
        opp.CurrencyIsoCode = 'USD';
        opp.CloseDate = date.parse('1/1/2199');
        opp.Managers_Email_Address__c = null;
        return opp;
    }
}

My System.assertEquals is evaluating to false.  When I debug the value at the very end of the main class it is set properly.  But, it isn't populating to the opp variable in the test class.  What am I missing here?


 
I have the following trigger:

trigger activeOpp on Opportunity (after insert, after update) {
    
    List<contact> conUpdList = new List <contact>();
    List<Id> oppConIDList = new List<Id>();
    List<opportunity> oppConList = new List<opportunity>();
    List<Contact> conList = new List<Contact>();
    Map<ID, Contact> conMap = new Map<ID, Contact>();

    
    for (opportunity opp: Trigger.new){
      system.debug(opp.StageName+ ' ' +opp.Contact__c);
        if(opp.Contact__c!= null){
            oppConList.add(opp);
            oppConIDList.add(opp.Contact__c);
            system.debug(opp.Contact__c);
        }
    }   
    
    if(!oppConIDList.isEmpty()){   
        conList  = [select ID, Active_Opportunity__c from contact where ID = :oppConIDList];
       
    }
        
    if(!conList.isEmpty()){
        for(Contact con : conList){
            conMap.put(con.ID,con);     
        }
    }
        if(!oppConList.isEmpty()){    
        for(Opportunity optyObj : oppConList){
       Contact c = conMap.get(optyObj.Contact__c);
            if( c!= null )
               
            {
            if (optyObj.StageName == 'Closed Won' || optyObj.StageName == 'Closed Lost'){
                c.Active_Opportunity__c = False;
                system.debug(c.Active_Opportunity__c);
            }
            
            else if(optyObj.StageName == 'Prospecting'
            || optyObj.StageName == 'Qualified Interest'
            || optyObj.StageName == 'Needs Analysis'
            || optyObj.StageName == 'Value Proposition'
            || optyObj.StageName == 'Proposal/Price Quote'
            || optyObj.StageName == 'Negotiation/Review'
            || optyObj.StageName == 'Verbal Commit'
            || optyObj.StageName == 'Closed Pending'){
                c.Active_Opportunity__c = True;
            }
            conUpdList.add(c);        
        }
    }
    }
    if(!conUpdList.isEmpty()){
        update conUpdList;
    }
}
I am trying to use the following test, but not sure why it is only giving me 75%?  Any help on why I can't get this working.

@isTest

private class TestOppTrgWContUpd {

    static testmethod void TestOpportunityTrgr() {
   
           Test.startTest();

       // Create two contacts

           Contact ct1 = new Contact();
           Contact ct2 = new Contact();
           ct1.FirstName = 'John';
           ct1.LastName = 'Doe';
           ct2.FirstName = 'Jane';
           ct2.LastName = 'Smith';
           //ct1.Account = 'Public School';
          // ct2.Account = 'Public School';
           ct1.Category__c = 'Public School';
           ct2.Category__c = 'Public School';
           ct1.Role__c = 'Instructional Technology';
           ct2.Role__c = 'Other';
           ct1.Email = 'jdoe@school.edu';
           ct2.Email = 'jsmith@hed.edu';
           Insert ct1;    
           Insert ct2;

           system.debug('Completed Contact Creation'); 

           

     

        // Create Opportunity

          Opportunity op1 = new Opportunity();
          Opportunity op2 = new Opportunity();
          
          op1.name = 'Opportunity Contact Insertion Test';
          //op1.account = 'Public School';
          op1.CloseDate =  Date.today()+2;
          op1.StageName = 'Prospecting';
          op1.forecastcategoryname = 'Pipeline';   
          op1.Contact__c = ct1.Id ;

          //insert op1;
          
          op1.name = 'Opportunity Contact Insertion Test';
          //op1.account = 'Public School';
          op1.CloseDate =  Date.today()+2;
          op1.StageName = 'Prospecting';
          op1.forecastcategoryname = 'Pipeline';   
          op1.Contact__c = ct1.Id ;
          
          //insert op2;
          
          Database.SaveResult sr1 = Database.insert(op1, true);
          Database.SaveResult sr2 = Database.insert(op2, true);

          System.assert(sr1.isSuccess());
          System.assert(sr2.isSuccess());

          system.debug('Inserted new opportunity');

          

       // Update Opportunity with new contact

 

          op1.Contact__c = ct2.Id;

          //update op1;

          Database.SaveResult sr3 = Database.update(op1, true);

          System.assert(sr3.isSuccess());

          system.debug('Opportunity updated');

          

          Test.stopTest();

          System.assert(sr3.isSuccess()); 

    }    

}
Hi,

I have a custom object (inspection) which has a lookup to the account object. The account object also has a formula field called SPAN. In an Apex class I'd like to create an inspection with a lookup to an account. It's a little weird how the data comes to the class but here it is:

@RestResource(urlMapping='/inspection/*')
global with sharing class InspectionRestController{
   global class RequestBody {
       global Inspection__c inspection;
   }

    @HttpPost
    global static Inspection__c create(InspectionRestController.RequestBody req) {
        Inspection__c newInspection = req.inspection;
        
        if (req.inspection.Account__r != null) {
            String span = req.inspection.Account__r.SPAN__c;
            
            Account account = [select Id from Account where SPAN__c = :span];
            
            newInspection.Account__c.Id = account.Id;
        }
    
        insert newInspection;
        return newInspection;
    }
}

I've tried to attach the account to the inspection in every way possible (new Account(Id = account.Id), etc...). I know I'm getting the correct account by the query because I've logged it out during debugging. 

Any idea what I'm doing wrong?

Thanks
I'm trying to grab the ID from the Visualforce page, pass it into a list, and if ID is in the list remove it from my cart. I'm getting a "Incompatible key type List&lt;Id&gt; for Map&lt;Id,StoreFront2.DisplayMerchandise&gt;" on line 26.

Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" controller="StoreFront2">
  <apex:stylesheet value="{!URLFOR($Resource.styles)}"/>
  <h1>Store Front</h1>
    <apex:variable var="rowDel" value='{!0}'/>
  <apex:form >
      <apex:dataTable value="{!products}" var="pitem" rowClasses="odd,even">
          
          <apex:column headerValue="Product">
              <apex:outputText value="{!pitem.merchandise.name}" />
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!pitem.merchandise.Price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:inputText value="{!pitem.tempCount}"/>
          </apex:column>
   
      </apex:dataTable>
      
      <br/>
      <apex:commandButton action="{!shop}" value="Add to Cart" reRender="msg,cart" >
      
      </apex:commandButton>
  </apex:form>
  
    <apex:outputPanel id="msg">{!message}</apex:outputPanel><br/>    
    <h1>Your Basket</h1>
    
<apex:form>    
     <apex:dataTable id="cart" value="{!cart}" var="carti" rowClasses="odd,even">
			
   <apex:column headerValue="ID" rendered="false">
       <apex:outputText value="{!cart[carti].merchandise.Id}" >
         	<apex:param name='rowDel' value="{!cart[carti].merchandise.Id}" />
       </apex:outputText>
          </apex:column>
          <apex:column headerValue="Product">
              <apex:outputText value="{!cart[carti].merchandise.name}">
          	
         </apex:outputText>
          </apex:column>
          <apex:column headervalue="Price">
              <apex:outputText value="{!cart[carti].merchandise.price__c}" />
          </apex:column>
          <apex:column headerValue="#Items">
              <apex:outputText value="{!cart[carti].count}"/>
          </apex:column>
         <apex:column headerValue="Remove?">
             <apex:commandButton action="{!Remove}" value='Remove' reRender="cart" />
         </apex:column>
                     

      </apex:dataTable>
    </apex:form>
    
  
</apex:page>
Apex
public class StoreFront2 {    
    public String message { get; set; }
    List<DisplayMerchandise> products;
    Map<Id, DisplayMerchandise> cart;
    public List<Id> row2Del{get;set;}
    private Id rowz;
    public id rowDel{get;set;}
    
    public PageReference shop(){
   
        handleTheBasket();
        message = 'You bought: ';
        for (DisplayMerchandise p:products){
            if(p.tempCount > 0){
               message += p.merchandise.name + ' (' + p.tempCount + ') ' ;
               }
            }
        return null;
    }
    
    public void remove(){
     rowz = ApexPages.currentPage().getParameters().get(rowDel);
        row2Del.add(rowz);
        
        if(cart.containsKey(row2Del)){
            cart.remove(row2Del);
            
        }
     
        
         
    }

    public void handleTheBasket(){
        for(DisplayMerchandise c : products){
            if(c.tempCount > 0){
            if(cart.containsKey(c.merchandise.Id)){
                
                cart.get(c.merchandise.Id).count += c.tempCount;
                
            }
            else{
                cart.put(c.merchandise.Id, c);
                cart.get(c.merchandise.Id).count = c.tempCount;
             
          		

            } 
        
        }
        }
        
    }
    
    
    public Map<Id, DisplayMerchandise> getCart() {
        if(cart == null){
            cart = new Map<Id, DisplayMerchandise>();
 
                }
       
        return cart;
    }

    public class DisplayMerchandise {
        public Merchandise__c merchandise{get; set;}
        public Decimal count{get; set;}
        public Decimal tempCount{get;set;}
        public Integer rowNumber { get; set; }
        public DisplayMerchandise(Merchandise__c item){
            this.merchandise = item;
            
        }
    }

    public List<DisplayMerchandise> getProducts() {
        if (products == null){
            products = new List<DisplayMerchandise>();
    
            for (Merchandise__c item :
            [SELECT id, name, description__c, price__c
            FROM Merchandise__c
            WHERE Total_Inventory__c > 0]) {
           
            products.add(new DisplayMerchandise(item));
            }
        }
        return products;
    }

}


 
I am trying to adapt my first VF page with Force.com Site for a simpe input form. I have adapted the code found here for my custom object:

https://developer.salesforce.com/page/Creating_Custom_Web-To-Case_Forms_Using_Visualforce_and_Sites

My intake page shows correctly in my site but when I click "Submit Project" I get the following error:

"List has no rows for assignment to SObject"

I am assuming the problem is in this line of code:

pr.Account__c = accts.get(0).Id;

but I do not know why my list has no rows if I enter a valid account name on my form? If I enter an invalid account name or leave the account name blank, i do get the correct error message 'Invalid Account Name' as expected.

Here is my code:

APEX CLASS:

public with sharing class SubmitProjectController {
    
    public Projects__c  pr { get; set; }
    
    public String acctName { get; set; }
    
    public String opptyName { get; set; }
    
    public SubmitProjectController() {
        pr = new Projects__c ();
    }
    
    public PageReference submitProject() {
        List<Account> accts = [SELECT Id FROM Account WHERE Name = :acctName];
        if (accts.size() != 1) {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Invalid account name');
            ApexPages.addMessage(msg);
            return null;
        } else {
            try {
                pr.Account__c = accts.get(0).Id;
                
                // now look for an associated opportunity with the same name
                Opportunity opt = [SELECT Id FROM Opportunity WHERE AccountId = :pr.Account__c AND Name = :opptyName LIMIT 1];
                if (opt != null) 
                    pr.Opportunity__c = opt.Id;
                    

                // Insert the project
                INSERT pr;
                return new PageReference('/Thank_You');
            } catch (Exception e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
    }
}


VF PAGE:


<apex:page controller="SubmitProjectController">

    <h1>Submit New Project </h1>
    
    <apex:form >
        <apex:pageMessages />
        <table>
            <tr>
                <th>Project Name:</th>
                <td><apex:inputText value="{!pr.Name}"/></td>
            </tr>
            <tr>
                <th>Account Name:</th>
                <td><apex:inputText value="{!acctName}"/></td>
            </tr>
            <tr>
                <th>Opportunity Name:</th>
                <td><apex:inputText required="true" value="{!opptyName}"/></td>
            </tr>
            <tr>
                <th>Project Description:</th>
                <td><apex:inputTextArea required="true" rows="5" value="{!pr.Description__c}"/></td>
            </tr>
            <tr>
                <td><apex:commandButton value="Submit Project" action="{!submitProject}"/></td>
            </tr>
        </table>
    </apex:form>

</apex:page>


I am an absolute beginner in Apex and VF and I would appreciate any help, thank you.
Tamar Erlich
While implementing emp API in LWC to subscribe the platform event I  find out that there is small issue in sample code snipit given in documentation.
Issue is in handleSubscribe method in js below is the code given in documentation:
handleSubscribe() {
        // Callback invoked whenever a new event message is received
        const messageCallback = function(response) {
            console.log('New message received : ', JSON.stringify(response));
            // Response contains the payload of the new message received
        };

        // Invoke subscribe method of empApi. Pass reference to messageCallback
        subscribe(this.channelName, -1, messageCallback).then(response => {
            // Response contains the subscription information on successful subscribe call
            console.log('Successfully subscribed to : ', JSON.stringify(response.channel));
            this.subscription = response;
            this.toggleSubscribeButton(true);
        });
    }
 Correction is required in messageCallback method which should be as below:
const messageCallback = (response) => {
        console.log('New message received : ', JSON.stringify(response));
        this.payload = JSON.stringify(response);
        console.log('this.payload: ' + this.payload);
        // Response contains the payload of the new message received
    };
We have to use arrow function as it does not have its own scope.  
Hi All,

I have crate opportunity in custom VF page. I want to show all the information in somewhere into document. document page is 10. i need some suggestions of its functionality. cau you help.
Hi--I have a requirement where I have to create custom button that unchecks the checkbox value if the checkbox is already checked.
Somehow I am able to check the checkbox value to false by click on custom button.but the biggest showstooper that I am facing in my requirement is we have 5 tabs & if I click on  any one of the tabs then I have to caputure the ID or the name of the tab that i clicked on it.
I have write the following code;


​For Button:
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}
sforce.connection.sessionId = '{!$Api.Session_ID}';
var Result = sforce.apex.execute("OutcomeController","checkboxFalse", {opportunityId: "{!Opportunity.Id}"});
alert('Result:'+Result);
if(Result=='false'){
window.location.reload();
}


 
Controller Class:
 
global with sharing class OutcomeController {
    public string myStage{get; set;}
    ......................
 
  public Map<String, List<VerifiableOutcome__c>> OutcomesByStage {
        get {
            if (OutcomesByStage == null) {
                OutcomesByStage = new Map<String, List<Outcome__c>>();
            }
            return OutcomesByStage;
        }
        private set;
    }

 
    public void StageNme()
    {
        system.debug('myStage:'+myStage);
    }
 
 
   
        webservice static boolean checkboxFalse(Id opportunityId)
    {
    Opportunity currentOpportunity = OpportunityServices.getOpportunity(opportunityId);
      Outcome__c voi1= VerifiableOutcome__c.getValues('Solution Implemented');  
     Outcome__c voi2= VerifiableOutcome__c.getValues('Schedule Created');     
      system.debug('voi1 stage NAme:'+voi1.StageName__c);
       system.debug('voi2 stage NAme:'+voi2.StageName__c);
  
          
                //system.debug('vo name:'+vo);
                if (currentOpportunity.get(voi1.FieldName__c) == true && voi1.StageName__c=='Implement') {
                currentOpportunity.SolutionImplemented__c=false;
                update currentOpportunity;  
                }
                if(currentOpportunity.get(voi2.FieldName__c) == true && voi2.StageName__c=='Cause')
                {
                currentOpportunity.ScheduleCreated__c=false;
                update currentOpportunity; 
                }
                else{
                    return true;
                }
               
                return false;
       
    }
}


VF Page:
 
<apex:page docType="html-5.0" standardController="Opportunity" extensions="OutcomeController" showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false">
<html>
<head>
<script>
var j$ = jQuery.noConflict();

j$(function() {

  
    j$('.voCheckbox').click(function() {
        j$('[id$=":selectedVerifiableOutcomeIdInput"]').val(j$(this).data("outcome"));
        j$('[id$=":currentStageInput"]').val(j$(this).data("stage"));
        completeVOActionJSCheck();
       
    });     
    // get tab container
    var container = document.getElementById("tabcontainer");
    var tabcon = document.getElementById("tabscontent");
    var navitem = document.getElementById("tabheader_{!SUBSTITUTE(currentStage,' ','')}");
  
    if (navitem != null) {
        //store which tab we are on
        var ident = navitem.id.split("_")[1];
        navitem.parentNode.setAttribute("data-current",ident);
       //set current tab with class of activetabheader
        navitem.setAttribute("class","active");
       
    }
    //this adds click event to tabs
    var tabs = container.getElementsByTagName("li");
    console.log('tabdata8:'+tabs);
    for (var i = 0; i < tabs.length; i++) {
    tabs[i].onclick=displayPage;
    console.log('tabdata9:'+tabs[0]);
   
    }
    // show active panel
  
    var curTab = document.getElementById("tabpage_{!SUBSTITUTE(currentStage,' ','')}");
    console.log('tabdata10:'+curTab);
    if (curTab != null) {
        curTab.style.display='block';
    }
});

// on click of one of tabs
function displayPage() {
   
    var current = this.parentNode.getAttribute("data-current");
    console.log('current tab name'+current);
    if (current != null) {
        //remove class of activetabheader and hide old contents
        document.getElementById("tabheader_" + current).removeAttribute("class");
        document.getElementById("tabpage_" + current).style.display="none";
    }
    ident = this.id.split("_")[1];
    console.log('ident:'+ident);
   
    //add class of activetabheader to new active tab and show contents
    this.setAttribute("class","active");
    document.getElementById("tabpage_" + ident).style.display="block";
    this.parentNode.setAttribute("data-current",ident);
}

 /*function dosomejavascript()
 { // set up my param to pass to action function
 var myParam = 'abc';
 //call my action function - myParam variable should be set to 'somevariable' in my controller
 StageNme(myParam);
 console.log('myParam Name:'+myParam);
 }*/
 

</script>

</head>

<body>

<!-- variables -->
<apex:variable value="{!Opportunity.Tender__c}" var="oppTender" />
<apex:variable value="{!Opportunity.AccountId}" var="oppAccId" />

<apex:form id="mainForm">

<apex:actionFunction action="{!completeVOActionKP}" name="completeVOActionJSKP" />
<apex:actionFunction action="{!completeVOActionDoc}" name="completeVOActionJSDoc" />
<apex:actionFunction action="{!completeVOActionCheck}" name="completeVOActionJSCheck" />
<apex:actionFunction action="{!StageNme}" name="StageNme"  rerender="">
<apex:param name="v" value="" assignTo="{!myStage}" />
</apex:actionFunction>


<apex:inputHidden value="{!selectedVerifiableOutcomeId}" id="selectedOutcomeIdInput" />
<apex:inputHidden value="{!currentStage}" id="currentStageInput" />

<!-- Error window -->
<apex:outputPanel rendered="{!isError}">
    <div class="modal" id="errorMessage" tabindex="-1" role="dialog" aria-labelledby="errorMessageModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Error</h4>
                </div>
                <div class="modal-body">
                    <p>{!errorMessage}</p>
                </div>
            </div>
        </div>
    </div>
    <script>
        j$('#errorMessage').modal('show');
    </script>
</apex:outputPanel>

<apex:outputPanel rendered="{!doParentReload && !isError}" layout="none">
    <script>
        // Go back to the opportunity detail page
        if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
            // Salesforce1 navigation
            //sforce.one.navigateToSObject(aId);
        }
        else {
            // Set the window's parent URL using a Visualforce expression
            window.top.location.href = '/{!Opportunity.Id}';
        }
    </script>
</apex:outputPanel>

<apex:outputPanel id="allTabs" layout="block">

    <!-- Steps -->
    <div id="tabcontainer">
        <div id="tabs">
            <ul class="stackedProgress">
            <apex:repeat value="{!stageNames}" var="stage">
                <li id="tabheader_{!SUBSTITUTE(stage,' ','')}" >
                    <div class="content">
                        <div class="ico">
                            <i class="{!verifiableOutcomesUI[stage].Icon__c} icon"></i>
                                <apex:outputPanel layout="none" rendered="{!stageCompletedOutcomes[stage] == true}">
                                    <i class="fa fa-check green secondaryIcon"></i>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!stageInWarningOutcomes[stage] == true}">
                                    <i class="fa fa-exclamation-triangle orange secondaryIcon"></i>
                                </apex:outputPanel>
                        </div>
                        <div class="stepText">
                            <span style="float:left; margin-right:5px;">
                                <apex:outputPanel layout="none" rendered="{!stageCompletedOutcomes[stage] == true}">
                                    <i class="fa fa-check green"></i>
                                </apex:outputPanel>
                                <apex:outputPanel layout="none" rendered="{!stageInWarningOutcomes[stage] == true}">
                                    <i class="fa fa-exclamation-triangle orange"></i>
                                </apex:outputPanel>
                            </span>
                            <strong style="overflow: hidden;">{!stage}</strong>
                            <div class="descr"><apex:outputText value="{!OutcomesUI[stage].Description__c}" /></div>
                        </div>
                    </div>
                </li>
            </apex:repeat>
            </ul>
        </div>

        <div id="tabscontent">

        <apex:repeat value="{!stageNames}" var="stage">
            <div class="tabpage" id="tabpage_{!SUBSTITUTE(stage,' ','')}" data-style="tab">

                <div class="leftCol">

                <h4 class="secondaryTitle">
                    <apex:outputPanel layout="none" rendered="{!stageCompletedOutcomes[stage] == true}">
                        <i class="fa fa-check green"></i>
                    </apex:outputPanel>
                    <apex:outputPanel layout="none" rendered="{!stageInWarningOutcomes[stage] == true}">
                        <i class="fa fa-exclamation-triangle orange"></i>
                    </apex:outputPanel>
                    {!stage}
                </h4>

                <h4>{!$Label.VO_Expected_Milestone_Completion_Date}:<span style="white-space: pre"> </span>
                    <span style="white-space: nowrap">
                    <apex:outputText value="{0,date,dd MMM YYYY}">
                        <apex:param value="{!currentOpportunity[stageToEndDate[stage]]}" />
                    </apex:outputText>
                    </span>
                </h4>

                <!-- <p class="secondaryDescription"><apex:outputText value="{!verifiableOutcomesUI[stage].Description__c}" /></p> -->

                <apex:repeat var="outcome" value="{!OutcomesByStage[stage]}">

                    <!-- INFO BLOCK -->
                    <apex:outputPanel layout="block" rendered="{!outcome.Type__c == 'CLASSIFICATION'}">
                        <p>
                            <label class="outcome-name">{!outcome.Name}:</label>
                            <apex:outputPanel layout="none" rendered="{!currentOpportunity[outcome.FieldName__c] == true}">
                                <i class="fa fa-check green"></i>
                            </apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!currentOpportunity[outcome.FieldName__c] == false}">
                                <i class="fa fa-times red"></i>
                            </apex:outputPanel>
                        </p>
                    </apex:outputPanel>

            
                    <!-- CHECKBOX BLOCK -->
                    <apex:outputPanel layout="block" rendered="{!outcome.Type__c == 'CHECKBOX'}">
                        <p>
                            <label class="outcome-name">{!outcome.Name}:</label>
                            <apex:outputPanel layout="none" rendered="{!currentOpportunity[outcome.FieldName__c] == true}">
                                <i class="fa fa-check green"></i>
                            </apex:outputPanel>
                            <apex:outputPanel layout="none" rendered="{!currentOpportunity[outcome.FieldName__c] == false}">
                               
                                <apex:outputPanel rendered="{!isEditAllowed}" layout="none">
                                    <input type="checkbox" class="voCheckbox" data-outcome="{!outcome.Id}" data-stage="{!stage}" style="vertical-align: middle" />
                                </apex:outputPanel>
                                <apex:outputPanel rendered="{!!isEditAllowed}" layout="none">
                                    <input type="checkbox" style="vertical-align: middle" disabled="true" />
                                </apex:outputPanel>

                            </apex:outputPanel>
                        </p>
                    </apex:outputPanel>

                </apex:repeat>

            </div>

            <div class="rightCol">
                <apex:outputText escape="false" value="{!$Label[verifiableOutcomesUI[stage].HelpLabel__c]}" rendered="{!oppTender=false}" />
                <apex:outputText escape="false" value="{!$Label[verifiableOutcomesUI[stage].HelpLabelTender__c]}" rendered="{!oppTender=true}" />
            </div>

            </div>
        </apex:repeat>
        </div>
    </div>
</apex:outputPanel>
</apex:form>

</body>
</html>
</apex:page>


if u have referred the VF code,there is a function called as 'Display Page' inwhich there is a variable called as 'Ident' that gives me the exact value of the tabs that i clicked and I must pass the Variable 'Ident' value to the controller class which i am trying to pass by using following syntax
 
<apex:actionFunction action="{!StageNme}" name="StageNme"  rerender="">
<apex:param name="v" value="Ident" assignTo="{!myStage}" />
</apex:actionFunction>



whatever the Stage Value I get in the Ident variable I have to pass the value and assign to the  Variable 'myStage' of the controller but I am not able to pass it out not sure why??
Can somebody please help me how can i pass the variable value to the controller class so that I can use it in my If() of Weservice method?
because right now the problem that I am facing while unchecking the checkbox is I am not able uncheck the exact checkbox of the current tab,it randomly executes the condition and randomly uncheck the checkbox and this is true because I am not able to pass the value of click event in my controller class.

Your Help is really appreciate for me to fix this issue.
 
Hey guys, please let me know how can I find that on which cloud I'm working on? whether it is sales, service or community.
Please guide.
I had the same problem.
Can someone plase help me to carry out the below step.
"Add values to your Chatter profile 'Title', 'About Me', and 'City' fields."
Hi..
I am new in salesforce. And i want to create a dashboard through which i can show the status of the org. I have shown the apex classes, and custom object with custom field count now i want to show the Validation rules and workflow count.

I have studied that it is possible throug Metadata API but i don't know how can i use them in salesforce apex class
Hi,
I can't find a way to create a report type for Contact and AccountContactRole to see
all contacts and their contact roles, any thoughts please ?

Best Regards
Rahma__c

Hi All,
I have an text  I am displaying based on a list size in my visualforce page.I an wondering if it is possible to dislpay a property in the apex code in the visualforce page.
callattemptList is my List based on wether it is empty or not  I want to display two different strings

<apex:pageBlock title="{!if(callattemptList.size>0,'!Username your tasks for the day','!Username not tasks found for you')}" id="theBlock" >
I need to pass the logged in username which is a propert in my apex code unable to find the right syntx for the same any help would be appreciated

Hi All,

I am exploring on Single Sign-On settings and came across a requirement where a User can login to his/her Box Account with Salesforce credentials using Singl Sign-On.
I have completed TrailHead module Set Up Single Sign-On for Your Internal Users which teaches SSO where Salesforce is the Service Provider and  Axiom Heroku web app is Identity Provider, i.e., we can login to Salesforce from a Third-Party Identity Provider.
But where as in my requirement, Salesforce would be Identity Provider and Box.com would be Service Provider.
It would be really helpful if someone can guide me for the soution or provide any links or tips to acheive this.

Thanks in Advance,
MJ

I have created a button to update the Task Contact ID  file as follows 
Behavior = Execute Javascript
Content Source = OnClick Javascript 
and 
{!Task.Who}={!Case.ContactId} 

When I use the button, I get the following error message. What am I doing wrong? 

A problem with the OnClick JavaScript for this button or link was encountered:

Unexpected token =


Yogesh
Where can I post a question about wave analytics?
Hi , I have 3 command buttons with different logics to be processed on each.
Now i want the command button to be higlighted on click and when 2nd buttton is clicked then only 2nd button must be highlighted.
Is it possible???
<apex:page controller="HideAndShow">
<apex:form >
<apex:commandButton value="firstButton" action="{!firstButton}"/>
<apex:commandButton value="SecondButton" action="{!secondButton}"/>
<apex:commandButton value="thirddButton" action="{!thirdButton}"/>
<apex:outputPanel id="one" title="one" rendered="{!firstPanel}">
<apex:pageblock >
<apex:pageblockSection >


<p>1111111111111111</p> </apex:pageblockSection></apex:pageblock>
</apex:outputPanel>

<apex:outputPanel id="two" title="two" rendered="{!secondPanel}">
<p>222222222222</p>
</apex:outputPanel>
<apex:outputPanel id="three" title="three" rendered="{!thirdPanel}">
<p>3333333333333</p>
</apex:outputPanel>

  </apex:form>

</apex:page>

 
Hi Friends,

I have two Dev org i.e ORG-A and ORG-B, both Org have their own community i.e ORG-A have community-a and ORG-B have community-b, now i need to implement SSO b/w these 2 communities uers. 

How can we achive this, Is it possible?
Thanks in advance for your help/trick and precious time.


Thanks
 
Hi All,

I think we can't do DML Operations in constructor. But as per my business logic i want to insert record when the page loads....Is it possible with Action tag in the Page component?

Pls suggest me 

Adv Thnx,
VSK 98
  • June 23, 2016
  • Like
  • 0
public class studenttrigger1 
{
    
    public void onbeforeinsert(list<myruchika__Student__c>TriggerNew)
    {
        createStatusofTeacher(TriggerNew);
    }
    void  createStatusofTeacher(list<myruchika__Student__c>TriggerNew)
    {
    set<ID> settech= New set<ID>();
    for(student__c objS:TriggerNew)
    {
     if(objS.myruchika__Teacher__c!=null)
     {
         settech.add(objS.myruchika__Teacher__c);
     }
    }
 map<ID,myruchika__Teacher__c> mapteach=new map<ID,myruchika__Teacher__c>([select ID, myruchika__statusofteacher__c from myruchika__Teacher__c where ID in:settech]);
     for(student__c objT:Triggernew)
     {
       If (objT.student__c!=null && mapstudent__c.get(objT.myruchika__Teacher__c)!=null)
           {
               teacher__c obj= mapteach.get(objT.myruchika__Teacher__c);
           
         if(obj.myruchika__statusofteacher__c==false)
         {
             objT.adderror('Teacher must be active to create student');
         }
          }
   }   
    
    }
            }



 
Hi All,

I have created some flows for quote to order in a free develper org. I want to move these flows to my project sandbox org where development need to happen. Is it possible to migrate the changes from free dev org to sandbox org?

 
Hi All,

I have VF page, where i have added that page in salesforce sites to acess that VF page for the for the external user. Now my problem is user is able to access my VF page without authentication. Salesforce is not asking any authentication.

I have tried by removing my page acess following below mentioned steps but external user is not able to access VF page. User is getting insufficiant privilege error message.

Go to Setup -> Communities -> All Communities -> click Manage -> Administration -> Pages -> Go to force.com -> Click on public access settings.

Can anyone advise me how to access Salesforce site VF page with authentication

Thanks,

Regards,
Anil Kumar

 
Hi Guys, 

I know its another one, but i've looked at similar issues to see if i can identify the cause of my code coverage failure but have not found anything.  So, i'm getting 0% code coverage for a new trigger and cannot see why.  Here is my Trigger:
 
trigger MilestoneTaskTrigger on MPM4_BASE__Milestone1_Task__c (before insert, before update) {

if ((Trigger.isBefore && Trigger.isInsert) || (Trigger.isBefore && Trigger.isUpdate)){


	// Create list to hold Milestone Components to update
	List<Milestone_Component__c> components = new List<Milestone_Component__c>();

	// Get list of all Milestone Components that are set in Prod but not in Test
	List<Milestone_Component__c> cmps = [SELECT Id FROM Milestone_Component__c WHERE PROD__c = True AND Test_Sandbox__c = False];

	for (Milestone_Component__c c : cmps){
		c.Test_Sandbox__c = True;
		components.add(c);
	}

	for (MPM4_BASE__Milestone1_Task__c task : System.Trigger.new){
		// Is Refresh Test checked
		if (task.Refresh_Test__c == True && task.MPM4_BASE__Complete__c == True){
			// update all milestone components
			update components;

			// unset Resfresh Test checkbox
			task.Refresh_Test__c = False;
		}
	}
}

}

And here's my test class:
 
@isTest
public with sharing class MilestoneTaskTriggerTest {
	static testMethod void  MilestoneTaskTriggerTest() {
		
		// Insert Project
		System.debug('Inserting Milestone Project');
        MPM4_BASE__Milestone1_Project__c project = new MPM4_BASE__Milestone1_Project__c (Name='DEVELOPMENT');
        try { insert project; } catch (exception e) {}

        // get Salesforce Project record type for Milestone? - Nah!! default record type will be used.
        
        // Insert Milestone
        System.debug('Inserting Milestone');
        MPM4_BASE__Milestone1_Milestone__c milestone = new MPM4_BASE__Milestone1_Milestone__c(Name='Milestone', MPM4_BASE__Project__c=project.id);
        try { insert milestone; } catch (exception e) {}
		
		// Insert Task
		System.debug('Inserting Task');
        MPM4_BASE__Milestone1_Task__c task = new MPM4_BASE__Milestone1_Task__c(Name='Task', MPM4_BASE__Priority__c='4 - Low');
        try { insert task; } catch (exception e) {}

		// Insert Components (x3)
		System.debug('Inserting Components');
        Component__c component1 = new Component__c(Name='Comp1');
        try { insert component1; } catch (exception e) {}

        Component__c component2 = new Component__c(Name='Comp2');
        try { insert component2; } catch (exception e) {}

        Component__c component3 = new Component__c(Name='Comp3');
        try { insert component3; } catch (exception e) {}

        Component__c component4 = new Component__c(Name='Comp4');
        try { insert component4; } catch (exception e) {}

		// Insert Milestone Components (x3) setting Prod in one of them and 2 in test
		System.debug('Inserting Milestone Components');
        Milestone_Component__c mscomponent1 = new Milestone_Component__c(SFDC_Component__c=component1.id, Test_Sandbox__c=False, PROD__c=TRUE, Milestone__c=milestone.id, Task__c=task.id, Action__c='Update');
        try { insert mscomponent1; } catch (exception e) {}

        Milestone_Component__c mscomponent2 = new Milestone_Component__c(SFDC_Component__c=component2.id, Test_Sandbox__c=TRUE, PROD__c=False, Milestone__c=milestone.id, Task__c=task.id, Action__c='Update');
        try { insert mscomponent2; } catch (exception e) {}

        Milestone_Component__c mscomponent3 = new Milestone_Component__c(SFDC_Component__c=component3.id, Test_Sandbox__c=TRUE, PROD__c=False, Milestone__c=milestone.id, Task__c=task.id, Action__c='Update');
        try { insert mscomponent3; } catch (exception e) {}

        Milestone_Component__c mscomponent4 = new Milestone_Component__c(SFDC_Component__c=component4.id, Test_Sandbox__c=False, PROD__c=False, Milestone__c=milestone.id, Task__c=task.id, Action__c='Update');
        try { insert mscomponent4; } catch (exception e) {}

		// Update Task.Refresh_Test__c to true and set task to complete
		System.debug('Updating Task');
        task.Refresh_Test__c = TRUE;
        task.MPM4_BASE__Complete__c = TRUE;
        try { update task; } catch (exception e) {}

		// Check that there are 3 Milestone Components flagged as in Test
		List<Milestone_Component__c> mscomponents = [SELECT Id FROM Milestone_Component__c WHERE Test_Sandbox__c = TRUE];
		System.assertEquals(false, mscomponents.size()==3, ' there should be only 3 milestone components with Test Sandbox set as true');

		// Check that the Refresh_Test__c flag is false now.
		MPM4_BASE__Milestone1_Task__c checktask = [SELECT Id, Refresh_Test__c FROM MPM4_BASE__Milestone1_Task__c WHERE Id = :task.id];
		System.assertEquals(false, checktask.Refresh_Test__c==False, ' Refresh Test flag should be false!');

	}
}

Any help is greatly appreciated.
Thanks
Aamir
  • June 22, 2016
  • Like
  • 0
While implementing emp API in LWC to subscribe the platform event I  find out that there is small issue in sample code snipit given in documentation.
Issue is in handleSubscribe method in js below is the code given in documentation:
handleSubscribe() {
        // Callback invoked whenever a new event message is received
        const messageCallback = function(response) {
            console.log('New message received : ', JSON.stringify(response));
            // Response contains the payload of the new message received
        };

        // Invoke subscribe method of empApi. Pass reference to messageCallback
        subscribe(this.channelName, -1, messageCallback).then(response => {
            // Response contains the subscription information on successful subscribe call
            console.log('Successfully subscribed to : ', JSON.stringify(response.channel));
            this.subscription = response;
            this.toggleSubscribeButton(true);
        });
    }
 Correction is required in messageCallback method which should be as below:
const messageCallback = (response) => {
        console.log('New message received : ', JSON.stringify(response));
        this.payload = JSON.stringify(response);
        console.log('this.payload: ' + this.payload);
        // Response contains the payload of the new message received
    };
We have to use arrow function as it does not have its own scope.  
Hi,

How to deploy a asp.net application in salesforce