• Rajasekhar T
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 8
    Replies
I have written the following WrapperClass, consisting different object records/rows/fields as members. How can I dynamically update this wrapper class object. in below coade i have used only two fields (id, name), but in future we cannt expect thse two fields are coming. Like we can get phone, email, DOB, State, country... etc fields to wrapper class. based on different object fields/ records/rows how can i update the wrapper class object
set<string> ids= new set<string>();
        List<fieldWrapper> datalist1 = (List<fieldWrapper>) JSON.deserialize(Datalist,List<fieldWrapper>.class);
        
        for(fieldWrapper wrapper: datalist1)
        {
            If(Filedvalue =='id'){
            ids.add(wrapper.id);
            }
            If(Filedvalue =='Name')
            {
               ids.add(wrapper.Name);
            }            
        }
        If(Filedvalue =='id'){
              query+=':ids';
            }
            If(Filedvalue =='Name')
            {
              query+=':ids';
            
         } 
         
        
        List<sObject> sobjList = Database.query(query);
        return sobjList;
    
    public class fieldWrapper
    {
        public string id;
        public string Name;
    }

 
I am working on a Salesforce 1 mobile app. I have a business requirement to open external App (Barcodescanner) in SF1 app. I have tried below methods.
* sforce.one.navigateToURL();
* window.open();

* function Capturesendvalue(){

             var returnscannedurl = document.getElementById('myPage:myForm:returnscannedurl').value;
             window.location = "Salesforcescan://scan?callback="+encodeURIComponent(returnscannedurl);

         }
But when i am login salesforce visualforce page in mobile brower native App is getting open and successfully Scanned barcode using native Barcode scan app. Same I want this to open native app(Barcode Scanner) in SF1 app only same as a mobile broweser for scanning to barcode.
I have created visualforce page on account object and when I have click on decode button after Capture the barcode image It will be decoded at the same time that decoded barcode value will be saved in account object.
But multiple barcodes having in one image how can I decoded that multiple barcodes in at a time and how can I save in account object.
How can I decode multiple barcodes having in one image(Like Below image).
User-added image

if image having one barcode am successfully decoded. This is my one barcode image decoded Code.
User-added image

Visualforce page:
<apex:page applyHtmlTag="false" showheader="false" sidebar="false" controller="BarcodeController">
    <head>
        <title>BarcodeReader</title>
        <apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.core.css')}"/>
        <apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.default.css')}"/>
        <apex:includeScript value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/lib/alertify.min.js')}"/>
    </head>
    <body>
        <div>
        <img width="320" height="240" src="" id="picture" style="border:10px groove silver" />
        </div>
        <input id="Take-Picture" type="file" accept="image/*;capture=camera"/>
        <p>If the picture looks clear, click the button to decode</p>
        <button onclick="DecodeBar();">Decode</button>
        <p id="textbit"></p>
      <!---  <button id="navigate" style="visibility:hidden;" onclick="navigate();">Go to record</button><br/> --->
     <!--- <button style="width:100%" onclick="window.location.reload();">Restart</button> --->
        <script type="text/javascript">
            var startTime;
            var interval;
            var recordId;

            var takePicture = document.querySelector("#Take-Picture");
            console.log('takePicture'+takePicture);
            showPicture = document.querySelector("#picture");

            Result = document.querySelector("#textbit");
            Canvas = document.createElement("canvas");
            Canvas.width=640;
            Canvas.height=480;
            var resultArray = [];
            ctx = Canvas.getContext("2d");

            showPicture.onload = function(){
                    ctx.drawImage(showPicture,0,0,Canvas.width,Canvas.height);
                  };

            var workerCount = 0;

                   function receiveMessage(e) {

                var elapsedTime=new Date() - startTime;
                if(e.data.success === "log") {
                    console.log(e.data.result);
                    return;
                }
                workerCount--;
                if(e.data.success){


                    clearInterval(interval);
                    var tempArray = e.data.result;
                    for(var i = 0; i < tempArray.length; i++) {
                        if(resultArray.indexOf(tempArray[i]) == -1) {
                            resultArray.push(tempArray[i]);
                        }
                    }
                    Result.innerHTML=resultArray.join("<br />") + '<br/>Decoded in ' + elapsedTime + ' milliseconds';

                    // notify the user of the success
                    alertify.success('Decoded barcode');



                    BarcodeController.getRecordFromBarcode(resultArray[0], recordRetrieved, {escape: false})

                }else{

                    if(resultArray.length === 0 && workerCount === 0) {

                        // stop the "working" messages
                        clearInterval(interval);
                        Result.innerHTML="Decoding failed in " + elapsedTime + ' milliseconds';

                        // notify the user of the failure
                        alertify.error('Unable to decode');

                    }
                }
            }
            var DecodeWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");
            var RightWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");
            var LeftWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");
            var FlipWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");
            DecodeWorker.onmessage = receiveMessage;
            RightWorker.onmessage = receiveMessage;
            LeftWorker.onmessage = receiveMessage;
            FlipWorker.onmessage = receiveMessage;
            if(takePicture && showPicture) {
                takePicture.onchange = function (event) {
                    var files = event.target.files
                    if (files && files.length > 0) {
                        file = files[0];
                        try {
                            var URL = window.URL || window.webkitURL;
                            var imgURL = URL.createObjectURL(file);
                            showPicture.src = imgURL;
                            URL.revokeObjectURL(imgURL);
                        }
                        catch (e) {
                            try {
                                var fileReader = new FileReader();
                                fileReader.onload = function (event) {
                                    showPicture.src = event.target.result;
                                };
                                fileReader.readAsDataURL(file);
                            }
                            catch (e) {
                                Result.innerHTML = "Neither createObjectURL or FileReader are supported";
                            }
                        }
                    }
                };
            }
            function DecodeBar(){
                    // start the timer for the decoding
                    startTime=new Date();
                    Result.innerHTML="";
                    resultArray = [];
                    workerCount = 4;

                    interval=setInterval(function(){alertify.log('Still working');},5000);

                    DecodeWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "normal"});
                    RightWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "right"});
                    LeftWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "left"});
                    FlipWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "flip"});
            }


            function recordRetrieved(result, event)
            {
                if ( (!event) || (event.status) ) 
                {
                    if (-1!=result.indexOf('Error'))
                    {
                        alertify.error(result);
                    }
                    else
                    {

                        document.querySelector("#navigate").style.visibility='visible';
                        recordId=result;
                    }
                }       
                else if (event.type === 'exception')
                {
                    alertify.error(result);
                }
            }


            function navigate()
            {

                if ( (typeof sforce != 'undefined') && (sforce != null) ) 
                {
                    sforce.one.navigateToSObject(recordId);
                }
                else 
                {
                    window.location="/" + recordId;
                }        
            }
        </script>
    </body>
</apex:page>

Controller:
public with sharing class BarcodeController
{
    @RemoteAction
    public static String getRecordFromBarcode(String bcStr)
    {
        String result;
        List<String> eles=bcStr.split(':');

        String code=eles[1].trim();
        List<Account> accs=[select id, Barcode__c from Account where Barcode__c=:code];
        if (0!=accs.size())
        {
            result=accs[0].id;
        }
        else
        {

         account a= new account();
         a.name ='Test barcode';
         a.Barcode__c =code;

         insert a;


        }

        return result;
    }
}

Static resource:
http://fabien-d.github.io/alertify.js/

​​​​​​​
How to create a attacment from visualforce site? I have created godaddy domain in our salesforce and given certificates for domain. for this domain i have access to view the visuaforce pages.I have created visualforce page as renderas"PDF" and i am calling from visualforce page attachment is created successfully but when i run the page from site its not created the attachment. i have given access the visualforce page andenter code here apex controller and also i have given access to object and fields. see below code.
 
account acc =[select id,name from account where id='myrecordid'];
pagereference pgref = page.mypdfpage;
pageref.getParameters().put('id',acc.Id);
pageref.setRedirect(false);
blob body;
body= pageref.getContentAsPDF();
Attachment attach = new Attachment();
attach.body = body;
attach.Name = 'myattachpage';
attach.Isprivate = false;
attach.ParentId = acc.Id;
attach.ContentType = 'pdf';
insert attach;

 
 I have applyed genaral themes for Quote object Records view. here my requirement is i want to divide Quote records and Quote line field sets (Standard line item Drawer) using Theme in CPQ.
can any one suggest me how to apply theme for Quote line field sets (Standard line item Drawer) in Quote Object Records View. 
I have two classes. in the first class account object having two lookup fields like "ship from" and "ship to". but these lookup object is one that is Address__c object. these lookup fields have different records.
totalrecords.totalamount(Address__C.Ship_To__c, Address__C.Ship_From__c, contact.type);
my requirement is how to pass these two object values to second class in this first set object parameter.
testcal(Set<Address__c>AddressSet, string type)
like below method
public static Decimal testcal(Set<Address__c>AddressSet, string type){ }
please check below my code
list<Account> someAddress = [SELECT ID, Ship_To__c, Ship_From__c FROM Account WHERE Id = :someID]; 

Set<Id> addressIds = new Set<Id>();

 for(account acc:someAddress ){ 

addressIds.add(acc.Ship_To__c); 
addressIds.add(acc.Ship_From__c); 

} 
Set<Addresss__c> addresses = new Set<Addresss__c>([SELECT Id, Other_Fields__c FROM Addresss__c WHERE ID IN :addressIds]);

 for(account acc1:newvalues()){

 TestCal(addresses, Contact.Type);

 }
i had written like this but it is not passing particular account to particlur address. i got list of address in set but account for loop how to pass particular address to particular account. 
 
I want to display the custom error message on page when page is reloading, page contains only save button. However, i want to show the only custom error message on page at that time i want to hide save button.
 
<apex:page standardController="Account" extensions="myaccountcontroller">
<apex:form >
<apex:pagemessages ></apex:pagemessages>
    <apex:commandButton value="Save" action="{!Save}"/>
</apex:form>
</apex:page>


public class myaccountcontroller
{
  public string accId {get;set;}
  public String finalamount {get;set;}

  public myaccountcontroller(ApexPages.StandardController sc)
  {
    accId = ApexPages.CurrentPage().getParameters().get('Id');

    doCalculation();
  }

  public void doCalculation()
  {
    Account AccObj = [SELECT Id,Name,Amount__c,Total_Amount__c FROM Account WHERE Id=:accId ];
    system.debug('TotalAmount ###:'+AccObj.Total_Amount__c );
   try{
        finalamount  = String.ValueOf(AccObj.Amount__c/0);
        system.debug('finalamount###:'+finalamount);
     }catch(Exception e)
     {
        if(e.getMessage() == 'System.NullPointerException: Attempt to de-reference a null object')
        {

          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Unite Price should not be empty'));
        }
     }
  }


}

 
I have created visual force page for updating records from the page. in my code Owner__c is Parent, Vehicle__c is Child. once i enter value owner object discount__c field , i need to update same value in Vehicle object Disc__c filed.  save button is not working and not updating my data in dynamically. Why this happening? How can I resolve this issue. Please can any one help me out. Please find the below my code.
Page:
<div class="slds-col slds-size_6-of-12">
                            <label class="slds-form-element__label"> Discount:
                                 </label>
                           <b><label class="slds-form-element__label"><apex:inputfield value="{!Owner__c.Discount__c}"/></label></b> 

                        </div>

      <apex:commandButton styleClass="slds-button slds-button_brand" status="status"
                                                        action="{!Save}"
                                                        reRender="none" value="Save" id="saveButton"/>


Controller:

public with sharing class OwnervehicleController {

  public List<Vehicle__c> Retest{ get; set; }
    public Owner__c Offer {get;set;}
    public String OwnrId { get; set; }

     public OwnervehicleController(ApexPages.StandardController sc) {

        OwnrId = sc.getId();

        Retest = [
                SELECT Id,Name,Owner__c,Disc__c FROM Vehicle__c
                WHERE Owner__c = :OwnrId ];
        Offer = [SELECT id,Discount__c FROM Owner__c 
                 WHERE id = : OwnrId];
    }

    public PageReference Save(){   
   Update offer;

    Owner__c sc=[select id,Discount__c from Owner__c where id=:OwnrId];    
   
    list<Vehicle__c> Vcle=[select id,Disc__c,Owner__c From Vehicle__c where 
    Owner__c=:sc.id];

    for(Vehicle__c oitem:Vcle)
    {
    oitem.Disc__c =sc.Discount__c;   

    }
   update sc; 
     update Vcle;


        Update Retest; 
        PageReference pg = new PageReference('/'+OwnrId);
         pg.setRedirect(true);

        return Null;


    }

​​​​​​​
Opportunity product Standard Button "Edit Products" Button not visible in Opportunity related list Partner Community Portal Mobile View. How can I add that button to Ipad/mobile view.

I have Implementing component for creating new opportunity record whenever user click new opportunity button custom object detail page. It is working fine in lightning experience window but not in partner portal.

 

Component:

<aura:component implements="lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global"
                controller="NewOpportunityCreation">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
</aura:component>

Component Controller:

({
    doInit : function(component, event, helper) {
        var action = component.get("c.getEmployeeobject");
        action.setParams({"EmpId":component.get('v.recordId')});

        // Configure response handler

        action.setCallback(this, function(response) {           
            var state = response.getState();       
            if(state === "SUCCESS") {     
                var returnVal = response.getReturnValue();
                if($A.util.isEmpty(returnVal)){
                    $A.get("e.force:closeQuickAction").fire();
                    return;
                }
                var createRecordEvent = $A.get("e.force:createRecord");
                createRecordEvent.setParams({
                    "entityApiName": "Opportunity",
                    "defaultFieldValues": {
                        'AccountId' : returnVal.AccountId,
                        'Emp__c' : component.get('v.recordId')
                    },
                    "recordTypeId":returnVal.RecordTypeId
                });
                createRecordEvent.fire();
                $A.get("e.force:closeQuickAction").fire();
            } else if (state == "ERROR"){

            } 

        });
        $A.enqueueAction(action);           
    },
})

Apex Class:

public class NewOpportunityCreation {
    @AuraEnabled
    public static wrappClass getEmployeeobject(String EmpId){
        wrappClass wrapcls = new wrappClass();
        try{
            wrapcls.AccountId = [Select Account__c from Emp__c where Id=:EmpId].Account__c;
            wrapcls.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('OPP').getRecordTypeId();
        }catch(Exception ex){
            System.debug('Exction Occured'+ex.getMessage());
        }
        return wrapcls;
    }

    public class wrappClass{
        @AuraEnabled
        public Id AccountId {get;set;}
        @AuraEnabled
        public Id RecordTypeId {get;set;}
    }
}

Can you anybody help me to fix the issue.

How can I give them Desktop view access to Partner"community" users in Tablet/Mobile devices Browsers. ex: need to show entire calender access in home page like desktop view and need to show opportunity list view in drop down. please check below images.

User-added image
In my database contact object having 10records. in list view when i drag the 9th record to 2nd record it will be replaced. But while refreshing the records page or component it will be change existing position. So once i drag and drop the records i need to save automatically in database. 

please check my below drag and drop (sorting) code. can one suggest me how can i achieve my requirement(saving the sorting records automatically).

Controller:
public class ConDragandDropController{


      @AuraEnabled
       public static Contactwrap getContactwrap(String objName, String[] objFields) {

           String query = 'SELECT Id, ';
           for(String s:objFields){
               query += s+' ,';
           }
           query = query.removeEnd(',');
           query += ' FROM ' + objName;
           System.debug('qq  ' + query);

           return new Contactwrap(Database.query(query));
       }


       public class Contactwrap{
           @AuraEnabled
           List<sObject> records {get;set;}

           public Contactwrap(List<sObject> recs){
               this.records = recs;
           }
       }

}


Component:

<aura:component controller="ConDragandDropController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:attribute name="objName" type="String"/>
    <aura:attribute name="objFields" type="String[]"/>
      <aura:attribute name="dragid" type="Integer" access="private" />
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="ContactData" type="ConDragandDropController.Contactwrap"/>
    <div class="slds-page-header">
        <div class="slds-media">
            <div class="slds-media__figure">
                <span class="slds-icon_container" title="Description of icon when needed">
                    <lightning:icon iconName="utility:kanban" variant="bare" size="small"/>
                </span>
            </div>
            <div class="slds-media__body">
                <h1 class="slds-page-header__title slds-truncate slds-align-middle" title="Contact Records">Contact Records</h1>
            </div>
        </div>
     </div>
     <div style="padding:0.5rem;">
         <div class="stageContainer" style="width:100%">
            <ul ondrop="{!c.drop}" ondragover="{!c.allowDrop}" class="slds-has-dividers_around-space dropZone" style="height:100%;overflow-y:auto;">
                   <aura:iteration var="objRecord" items="{!v.ContactData.records}"  indexVar="index">
                   
                        <li class="slds-item slds-m-around_small" draggable="true" ondragstart="{!c.drag}" id="{!objRecord.Id}" >
                            <article class="slds-tile slds-tile_board">
                                <h3 class="slds-truncate" title="{!objRecord.Name}">
                                    <a href="javascript:void(0);" onclick="{!c.doView}">
                                        <span class="slds-truncate" id="{!objRecord.Id}">{!objRecord.Name}</span>
                                    </a>
                                </h3>
                                <div class="slds-tile__detail slds-text-body_small">
                                    <p class="slds-text-heading_medium">First Name: ${!objRecord.FirstName} </p>
                                    <p class="slds-truncate" title="{!objRecord.FirstName}">
                                        <a href="javascript:void(0);" onclick="{!c.doView}">
                                            <span class="slds-truncate" id="{!objRecord.LastName}">{!objRecord.LastName}</span>
                                        </a>
                                    </p>
                                    <!-- <p class="slds-truncate" title="{!'Closing ' +objRecord.CloseDate}">Closing {!'Closing ' +objRecord.CloseDate}</p>-->
                                </div> 
                            </article>
                        </li>
                  
                </aura:iteration> 
            </ul>
        </div>    
    </div>   
</aura:component>

Controller.JS:

({
     doInit: function(component, event, helper) {
        
          var action = component.get("c.getContactwrap");
        
          action.setParams({
            "objName":component.get("v.objName"),
            "objFields":component.get("v.objFields")
         });
         
         action.setCallback(this, function(response){
            var state = response.getState();
             
            if (state === "SUCCESS") {
                console.dir(response.getReturnValue());
                component.set("v.ContactData", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    },
    
    doView: function(component, event, helper) {
        var editRecordEvent = $A.get("e.force:navigateToSObject");
        editRecordEvent.setParams({
            "recordId": event.target.id
        });
        editRecordEvent.fire();
    },
    allowDrop: function(component, event, helper) {
        event.preventDefault();
    },
    
    drag: function (component, event, helper) {
         
       
        event.dataTransfer.setData("text", event.target.id);
        
    },
    
    drop: function (component, event, helper) {
    var data = event.dataTransfer.getData("text");
         
    // Find the record ID by crawling up the DOM hierarchy
    var tar = event.target.closest('[id]');
        
    var contactData = component.get("v.ContactData"); 
    var index1, index2, temp; 
    // Find the index of each item to move
    contactData.records.forEach((v,i)=>{if(v.Id===data) index1 = i; if(v.Id===tar.id) index2 = i;});
       
    if(index1<index2) {
        // Lower index to higher index; we move the lower index first, then remove it.
        contactData.records.splice(index2+1, 0, contactData.records[index1]);
        contactData.records.splice(index1, 1);
        
       
    } else {
        // Higher index to lower index; we remove the higher index, then add it to the lower index.
        temp = contactData.records.splice(index1, 1)[0];
        contactData.records.splice(index2, 0, temp);
        
    }
    
    // Trigger aura:valueChange, component will rerender
    component.set("v.ContactData", contactData);
        
    event.preventDefault();
}
})
Styles:
.THIS {
    

.THIS .slds-item {
    border: 1px solid #d8dde6;
    border-radius: 0.25rem;
    background-clip: padding-box;
    padding: 0.45rem;
    margin: 0.25rem;
}
.THIS .stageContainer{
 /*   width:320px; */
    float:left;
    border: 2px solid #d8dde6;
    margin: 0.05rem;
    border-radius: .25rem;
}
.THIS .slds-page-header__title {
    padding: 0rem 0.5rem;
    background: #f7f9fb;
}


.THIS .dropZone{
    min-height:25rem;
}
 

Application:

<aura:application extends="force:slds">
     <c:ConDragandDrop objName="contact" objFields="['Name', 'FirstName', 'LastName', 'Email', 'Phone']"/>
</aura:application>
In My sandbox Accounts Object having a two Record Types (B2B and person Account). but when i Change record type B2B to person account or person account to B2B, i can't pick, which Record Type i want to Change. When i use the Salesforce Classic View, i can see it. In Lightning and Partner community it doesnt work.

when i am click "Change record type" button am getting below error

User-added image
In my sandbox admin having access to see other calendars(events/tasks) in classic and Lightning. but in admin community not having access to see others calendar, as well as Parner community user also not having access to see other users calender events. How can i see like below other users calendar events in partner users calendar?User-added image
I have imported Test1.Test2 and Test3 users event data in admin user. Every users event data is available in Admin Calendar. Is possible to create and show specific user standard calendar in salesforce Homepage (short cut of caleder below) using visulaforce page/Component (Setup-Home-Home Page Components-New Custom Components-Visualforce Area). 
I know how to configure security model through OWD, Sharing Rules, Profiles and Roles in salesforce sandbox account but how to use Lightning Security LockerService instead of OWD, Sharing Rules...etc?
Can anyone briefly explain these Community cloud/ Community Portal concepts?
Objective
data model
Community cloud will be support Sales cloud Apex classes, Apex Triggers, Visualforce pages and Rules or not?
what are the sales cloud objects/features we will be use in community cloud?
How to get Users criminal background uncovers felony, misdemeanor public records information using corelogic to salesforce integration? 
if yes means how can i save that user criminal background information in salesforce.
I have created one site Ex: www.12345.com. i would like to have the View Tracks  for the site viewers for reporting purposes based on geolaction or what ever. when someone visit the my site in one day several times means how can i save/track the views count.  
What's the best way to achieve this?
I want the attachments to display like a single pdf. suppose i have 1 image file, 1 pdf and 1 text file then i want to display them into a single pdf.
 Is it possible? If yes how can i go for it?
I have two classes. in the first class account object having two lookup fields like "ship from" and "ship to". but these lookup object is one that is Address__c object. these lookup fields have different records.
totalrecords.totalamount(Address__C.Ship_To__c, Address__C.Ship_From__c, contact.type);
my requirement is how to pass these two object values to second class in this first set object parameter.
testcal(Set<Address__c>AddressSet, string type)
like below method
public static Decimal testcal(Set<Address__c>AddressSet, string type){ }
please check below my code
list<Account> someAddress = [SELECT ID, Ship_To__c, Ship_From__c FROM Account WHERE Id = :someID]; 

Set<Id> addressIds = new Set<Id>();

 for(account acc:someAddress ){ 

addressIds.add(acc.Ship_To__c); 
addressIds.add(acc.Ship_From__c); 

} 
Set<Addresss__c> addresses = new Set<Addresss__c>([SELECT Id, Other_Fields__c FROM Addresss__c WHERE ID IN :addressIds]);

 for(account acc1:newvalues()){

 TestCal(addresses, Contact.Type);

 }
i had written like this but it is not passing particular account to particlur address. i got list of address in set but account for loop how to pass particular address to particular account. 
 
I know how to configure security model through OWD, Sharing Rules, Profiles and Roles in salesforce sandbox account but how to use Lightning Security LockerService instead of OWD, Sharing Rules...etc?
Original question:
I have overriden my standard newContact page with a custom lightning component bundle. The reason i did this is to avoid  standard salesforce fields like account phone getting auto populated when creating a contact through Account related list. 

I utilized force:createRecord event and have resolved almost all of the issues except for only 1 which i am stuck and need to get it resolved.

Problem: The problem is that in my component i am retrieveing accountId and recordTypeID. When i click on an account i ended up on the detail page. Now when i click new contact from account detail related list, it invokes my lightning component which basically fires force:Createrecord event. Since i came from the account detail page, my parent window should be account detail page also but it is not. It basically hovers over to an empty 'Contacts'  tab. This is because the window URL has changed.

Original URL before creating new contact from account detail page:-
https://*.force.com/one/one.app#/sObject/001f400000AdMNOAA3/view

After clicking new contact :-
https://*.force.com/one/one.app#/sObject/Contact/new?recordTypeId=012f4000000DzRj&additionalParams=accid%3D001f400000AdMNO%26

My question is that is there any way i can take the user back to account detail page if he/she closes the modal dialog or click cancel ? or can i capture that event so i can invoke some JS function to redirect user to the correct page ? Please find my small test code below

ContactComponent.cmp
<aura:component implements="force:lightningQuickAction,lightning:actionOverride,force:hasRecordId,flexipage:availableForAllPageTypes,force:appHostable" access="global">
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <aura:attribute name="accid" type="Id" />
    <aura:attribute name="recordTypeId" type="Id" />
</aura:component>

ContactComponentController.js
({
    init : function(component, event, helper) {
        console.log('insideinit');
                var createAcountContactEvent = $A.get("e.force:createRecord");
                console.log('Account ID after action is ' + accId);
                createAcountContactEvent.setParams({
                    "entityApiName": "Contact",
                    "defaultFieldValues": {
                        'Phone' : ''
                    }
                });
                createAcountContactEvent.fire(); 
    }
}) 
I want the attachments to display like a single pdf. suppose i have 1 image file, 1 pdf and 1 text file then i want to display them into a single pdf.
 Is it possible? If yes how can i go for it?
I have encrypted password how to decrypt using 3des algorithm? is possible encrypting/decrypting anything in Apex Code?

Any help would be greatly appreciated

Raj
I received email with subject "Warning: Page Views Are at 105% of Your Limit".
I found PDF with this limit value but I don't understand who I can check how many pages were view at this moment.
On path "Develop > Sites > ~Our site label~ I can see only block "24-Hour Usage History" with metrics: "Origin Bandwidth" and "Request Time". Where I can see the count of sales force page views?

Warning message from email:
Dear Administrator: Our records indicate that your Force.com sites are close to your organization's monthly page view limit. This limit is cumulative for all the sites within your organization. Your current usage is at 105% of your current monthly page view limit of 500,000. If you exceed your monthly page view limit for your organization, your Force.com sites may be shut down until the next calendar month.
  • August 20, 2014
  • Like
  • 0

It would appear if a customer is using Communities or force.com sites there is no way to build scalable custom object URL buttons that work everywhere.

 

Let's say on the Account object you have a custom URL button that opens a Visualforce page with the following text:

 

/apex/findNearby?id={!Account.Id}

In this example we can't make the Content Source of the button Visualforce as this findNearby.page does not use a standard controller or extension.

 

For a normal user inside salesforce.com this works fine but let's say an org has a Community named 'customers'. This is were things start to break. That link should then redirect to:

 

/customers/apex/findNearby?id={!Account.Id}

 

So you might be thinking, no problem, just use the $Site global variable and do the following in the URL button:

 

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.

This would normally work but here is the final caveat...this is part of a managed packaged that needs to support Group and Professional editions and in these editions the $Site var does not exists.

 

Unless I am missing something this seems to be a gap in functionality for creating URL button links with Communities.

 

Is there anyway, within a button to detect the correct url or salesforce version and build the appropriate URL?

 

Thanks,

Jason

  • October 30, 2013
  • Like
  • 0