• Jakub Kołodziej 7
  • NEWBIE
  • 135 Points
  • Member since 2017

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 41
    Replies
Hello Developers

I am Trying to Design a Trigger where i have Custom Picklist Field called ('Months') where it Contains all 12 months name, Now my Requirement is that when Any Month is Selected, Start Date and End Date Should Auto populate based on Month,

Ex - If i Choose Janaury, Start Date and End Date of January Should Auto Populate in the those Start Date and End Date Fields, How Do i Achive this Functionality
Hello Sr. developers

Can someone tell me how can I pass Id with visualforce page
I'm calling a visualforce page with constent source URL , I know I can choose the visualforce page but I want to pass the Id
below is my code

visualforce page
<apex:page standardController="Campaign" extensions="OnLoadController" action="{!open_Donation_Site}" />

Extension
 
public class OnLoadController {
    Site subdomain;
    public OnLoadController(apexPages.StandardController con){}
    public String open_Donation_Site(){
        subdomain = [SELECT Subdomain FROM Site limit 1];
        Organization apt = [SELECT InstanceName FROM Organization];
        return 'https://'+subdomain.Subdomain+'.'+apt.InstanceName+'.force.com/CampaignPayment?id=';
    }
}
Actully I'm creating a managed pack that's why I want to fetch dynamically site domain name from different orgs.

my button
User-added image

It's saving but when I click button it gives error that page not found, but if i remove {!Campaign.Id} it works

I want to give visualforce page name and then Campaign.Id
Hello,
We have a custom object called Discharges. Before a new Discharge is inserted, I need to check to see if that person already has a Discharge record in the database. (Right now, I am just checking by name.) If they do have an existing record, I need to:
1. Make an update on the existing record (name_external_id__c)
2. Populate several fields on the new record based on data from the existing record.   

I'm not sure if this is the best way, but so far I added a custom field called "parent discharge" which is a lookup to itself. Is that the best way? And even if it is, once it is linked, how would I update the old record and populate the new one based on the old? Here is my trigger that I've written so far, but even this does not seem to work/ it is not automatically populating the lookup field. 

trigger DischargeTrigger on Discharge__c (before insert) {
   Set<String> newNameSet   = new Set<String>();
   Map<String,Id> oldNameMap    = new Map<String,Id>();
    
    for (Discharge__c disch : trigger.new){
        if (disch.Name != null && disch.Other_Diagnosis_ICD_Descriptions__c !=null ){
            newNameSet.add(disch.name);
        }
    }    
    if(!newNameSet.isEmpty()){
        for (Discharge__c oldDis : [SELECT Id, name, name_external_id__c, Discharge_Recurral__c, Previous_Discharge_Instances__c FROM Discharge__c WHERE name =:newNameSet]){
                 oldNameMap.put(oldDis.name, oldDis.id);
        }
    }
    if(oldNameMap.size() > 0){
        for (Discharge__c dis : trigger.new){
            if (dis.name != null && oldNameMap.get(dis.name)!= null){
                dis.Parent_Discharge__c= oldNameMap.get(dis.name);
            }
        }
    }
}

Any help is greatly appreciated.

 
I need to use Contact__c that I got in pol info query to compare it to the id of the cnt info query to get that info but what I have is obviously incorrect. Anybody have idea to fix that? Thank you.    

InputId = ApexPages.currentPage().getParameters().get('InputId');      

 PolInfo=[Select Id,Name,Policy_Number__c, Contact__c From PolContract__c where Id=:InputId];  
     
CntInfo=[Select Id,Name, MailingAddress from Contact where Id=:PolInfo.Contact__c];
Hello Developers

I am Trying to Design a Trigger where i have Custom Picklist Field called ('Months') where it Contains all 12 months name, Now my Requirement is that when Any Month is Selected, Start Date and End Date Should Auto populate based on Month,

Ex - If i Choose Janaury, Start Date and End Date of January Should Auto Populate in the those Start Date and End Date Fields, How Do i Achive this Functionality
Hello all

I am Trying to Design a Formula where i have Custom Picklist Field called ('Months') where it Contains all 12 months name, Now my Requirement is that when Any Month is Selected, Start Date and End Date Should Auto populate based on Month,

Ex - If i Choose Janaury, Start Date and End Date of January Should Auto Populate in the thosed Custom Fields, How Do i Achive this Functionality
Hello Sr. developers

Can someone tell me how can I pass Id with visualforce page
I'm calling a visualforce page with constent source URL , I know I can choose the visualforce page but I want to pass the Id
below is my code

visualforce page
<apex:page standardController="Campaign" extensions="OnLoadController" action="{!open_Donation_Site}" />

Extension
 
public class OnLoadController {
    Site subdomain;
    public OnLoadController(apexPages.StandardController con){}
    public String open_Donation_Site(){
        subdomain = [SELECT Subdomain FROM Site limit 1];
        Organization apt = [SELECT InstanceName FROM Organization];
        return 'https://'+subdomain.Subdomain+'.'+apt.InstanceName+'.force.com/CampaignPayment?id=';
    }
}
Actully I'm creating a managed pack that's why I want to fetch dynamically site domain name from different orgs.

my button
User-added image

It's saving but when I click button it gives error that page not found, but if i remove {!Campaign.Id} it works

I want to give visualforce page name and then Campaign.Id
Hi All,

I have the below Apex code running via a button on the Contact page
public with sharing class auto_sendSMS 
{
    public String phone {get;set;}

    public auto_sendSMS(ApexPages.StandardController stdController) {
    Contact contact = (Contact)stdController.getRecord();
    contact = [SELECT Id, phone from contact where Id = :contact.Id];
    
    String username = 'apiUser';
    String password = 'z448rcqAQ7w55ySK';
    String fromID = 'Cirrus';
    String dest = contact.phone;
    String body = 'API test';
    
    String requestEndpoint = 'https://auto.cirrusresponse.com/auto_sendSMS.asp';
    requestEndpoint += '?u=' + username;
    requestEndpoint += '&p=' + password;
    requestEndpoint += '&fromID=' + fromID;
    requestEndpoint += '&dest=' + dest;
    requestEndpoint += '&body=' + body;
    
    Http http = new http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint(requestEndpoint);
    request.setMethod('POST');
    HttpResponse response = http.send(request);
    
    }

}
I have set the remote site settings for the endpoint, but the request is never received.

I'd greatly appreciate if anyone can advise me where I've gone wrong in the above as the non-Apex version of the code is running sucessfully through Postman.

Kind regards
I need to add a Date field in "Approver Settings" section from "My Settings" page. I created this field "Delegate Till" - and added in User layout.
But this just adds field "Additional Information" section - Is there way to include under Approver Settings? If not, what workaround can I suggest?User-added image

Hi! Our org has 50+ workflow rules assigned to one custom object that I made a consolidated version with one process builder instance. After finishing with sandbox testing and on debug testing, business logics that are built with one process builder consumed more characters and CPU time when I executed one condition to meet one criteria. 

Process builder is .5-1 second slower than the workflow and runs 100,000 characters more. Which one is better? having 50+ workflows or slow performance? Is there any third solution?

Thanks

Jung

 

I had 5 fields in my custom object(My custom object is apex_leave_approval__c),and i tried to insert details in the fields through Visual Force page and save the record.But if I try to do this process using a apex code in the Visual Force page I get only the id in the record of my custom object.Please help me with an answer

This is my code

<apex:page StandardController="apex_Leave_Approval__c" >

  <h1>Leave request App</h1>
  <br/><br/>

   <apex:image url="https://image.shutterstock.com/image-vector/creative-stylish-elegant-connected-industrial-260nw-648984286.jpg" />
  <apex:form id="NitishApp">
  <apex:pageBlock title="Enter the Details Below">
  
        <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}" immediate="true"/>
        <apex:commandButton value="Cancel" action="{!Cancel}" />
        </apex:pageBlockButtons>
        
          
  <apex:pageBlockSection title="Enter the Details" columns="1">
             <apex:inputField id="Name"   value="{!apex_Leave_Approval__c.name}"  required="true"/>
              <apex:inputField id="ID" value="{!apex_Leave_Approval__c.apex_E_ID__c}" required="true"/>

             <apex:inputField id="Days_of_leave" value="{!apex_Leave_Approval__c.apex_Days_of_leave__c}" required="true"/>

             <apex:inputField id="Type_of_leave" value="{!apex_Leave_Approval__c.apex_Type_of_Leave__c}" required="true"/>

             <apex:inputField id="Approval" value="{!apex_Leave_Approval__c.apex_Approval__c}" required="true"/>
              
  
          </apex:pageBlockSection>
           </apex:pageBlock>
        
       
  </apex:form>

  
</apex:page>




With this code I could save only the Id but not the Actual message in the fields
When emails are sent manually through contacts , it doesn't display the entire message even after choosing "show entire message". but when sent automatically through a process builder they display the entire message. ( Here the emails are sent using an email template).
I have the issue SINGLE_EMAIL_LIMIT_EXCEEDED and after running this code from anonymous but have the same issue.
I am using setTargetObjectId then it not be count in the limit and mail send successfully.
But not working ??

Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage(); emailMsg.setTargetObjectId(contactid);
emailMSg.saveAsActivity = false; emailMsg.setSenderDisplayName('sender name'); emailMsg.setSubject('some subject'); emailMsg.setBccSender(false); emailMsg.setUseSignature(false); emailmsg.setPlainTextBody('email body'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emailMsg })
Hello all

I'm fairly new to Salesforce & Conga but I do know my way around now. I'm wondering if someone can help me with a report I'm trying to run.

I have a custom object called Risk_Profile__c which has a lookup relationship to Contact (Contact is parent and Risk Profile is child). I created a custom report type Contacts with Risk Profiles, a contact can have multiple risk profiles.

I'm trying to run the report so that I can find all Contacts with Risk Profiles (which is no problem) but the problem I have is that I just want the most recent Risk Profile based on created date and ignore the rest. 

I don't think I can do this with the report functionality alone so I'm trying to create a formula field in the Risk Profile object as a flag that I can search on which will return a result of the most recent record (perhaps this is not the most elegant approach). It would appear I can't use SOQL queries in a Salesforce report either.

Is what I want to do possible (whether by my method or some other method) I'm not au fait with Apex at the moment, that's something I need to learn.

Any help would be greatly appreciated...

Thanks 
I know this can be simplified if you are changing the Record Type with Actions or Quick Actions.  However, I'm using a flow because there are some variables I'm processing through loops and decisions to determine which Record Type I'd like to change to.  

I'm looking to have my users click a button, run the flow, and refresh the page to reflect the new record type (and corresponding page layout).  If I do a Screen Flow I end up having to put an end screen and have them click finish to get through the flow and refresh the record.  I haven't really looked into using an autolaunced flow, but maybe that's a possibility?

Is a custom button the way I should go?  User clicks the button, passes the recordId and kicks off the flow, runs the flow, and then refreshes the page?  Just not quick sure what that all looks like.  Any help is appreciated!
Is there is a way to fetch user security question from api?