• Arpit Jain7
  • SMARTIE
  • 660 Points
  • Member since 2015

  • Chatter
    Feed
  • 21
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 132
    Replies
Hi,
  
   I want to display the week number based  on quartrly of the year Please suggest me how to display
 
   Below is the image how it should be displayed
   User-added image

I wrote a formula which is giving quarter correctly but the week number is not displayed correclty
CASE(MONTH( CloseDate ),1,"Q4",2,"Q1",3,"Q1",4,"Q1",5,"Q2",6,"Q2",7,"Q2",8,"Q3",9,"Q3",10, "Q3",11,"Q4",12,"Q4","None")& "-W"&Text(CEILING( 
( 
DAY( CloseDate ) + 
MOD( DATE( YEAR( CloseDate ), MONTH( CloseDate ), 1 ) - DATE( 1900, 4, 1 ), 7 ) 
) / 7 
))

I need to display the weekly based on the image attached Please suggest me how to modifiy the formula.

Thanks
Sudhir
I have a validation rule:  AND( 
OR(BillingCountry = "US", BillingCountry = "USA", 
BillingCountry = "Hindustan"), 
NOT(REGEX(BillingPostalCode, 
"\\d{5}(-\\d{4})?")) )

I am not able to save  record after gave valid postal code.
Ex format:99999 or 99999-9999

Please let me know where i have done mistake
 
Hi, 

  I need to create a formual field based on a date which quater it belongs to and the week 

  Example : Date = 1-Jan-2018 I need a formula to display as Q4-W1
                   Date = 1-Feb-2018 I need a formula to display as Q1-W1
                   Date = 8-Feb-2018 I need a formula to display as Q1-W2
                   Date = 1-May-2018 I need a formula to display as Q2-W1
                   Date = 8-May-2018 I need a formula to display as Q2-W2

Please suggest me how to get this done in using salesforce formula.

Thanks
Sudhir
Hi, 
  
   We have a email field which should accept only @ . - as a special symbols if any other special symbols are entered it must not allow please suggest me how to add this valdiation 

Thanks
Sudhir
I want a list of all Objects in my org and displaying it in a drop down in Visualforce page. The code has compiled but giving unexpected error while getting Preview of VF page.

Controller : 
// Controller
public without sharing class getObjectNamesController {    
    
    public Map<String, Schema.SObjectType> object_Map = Schema.getGlobalDescribe(); 
    public Set<String> objNamesSet = object_Map.keyset();
    
    public List<SelectOption> objNamesList{     
        get{
            Integer i=0;
            for(String myObjName : objNamesSet)
            {
                objNamesList.add(new SelectOption(String.valueOf(i),myObjName)) ; 
                i++;
            } 	    	
            System.debug(objNamesList);   
            return objNamesList ;
        }
        set;
    }
}
VF Page: 
<apex:page controller="getObjectNamesController">
  <apex:form >
      <apex:selectList size="1">
          <apex:selectOptions value="{!objNamesList}"></apex:selectOptions>
      </apex:selectList>
  </apex:form>
</apex:page>
User-added image

 
Hi,

With the release Winter 18, some changes will occur concerning the sObject Attachment: with the related list, the button to add new attachment won"t be display anymore. The users couldn't add a new one. But what are the changes with Apex code ? could we still create new attachments by coding or not?

Than you so much in advance :)
Hi Gurus, 

I have a trigger on Task object and I am trying to before insert and update a field Task object. I am getting following error message:
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger WeekendTasks caused an unexpected exception, contact your administrator: WeekendTasks: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00T7F00000G5ulOUAR; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 00T7F00000G5ulO) is currently in trigger WeekendTasks, therefore it cannot recursively update itself: []: Trigger.WeekendTasks: line 15, column 1

Here is my trigger
trigger WeekendTasks  on Task (before insert,Before update) {
    list<Task> Tasweek =new List<Task>();
           for(Task tweek:Trigger.new){
                if(tweek.Subject != null) {
                   Date origin = Date.newInstance(1900,1,6);
                   Date due = tweek.ActivityDate;
                   Integer x = origin.daysBetween(due);
                   Integer day = Math.mod(x,7);
                   if (day < 2 ) {
                     Task tas = new Task (Id = tweek.Id,ActivityDate = (tweek.ActivityDate + 2));
                     Tasweek.add(tas);
                   }
                 }
           }
          update Tasweek;  
}
Hi Gurus,

I have written a test class for my apex extension page however, it’s only showing 33% coverage and I’m not to sure how to improve it as I’m new to writing test class.

Apex Extension Code:
 
public with sharing class extencntrl{
	
	Turndown__c turnd;
    public extencntrl(ApexPages.StandardController controller) {
        this.turnd= (Turndown__c)controller.getRecord();
    }
    
    public pageReference save()
		{
			Insert turnd; // steps to save your record.
			Pagereference pgref = New PageReference(Label.Turndown_Successfully_Submitted_Form);
			return pgref;
		}
}



Current Test Class showing 33% coverage:
 
@isTest
public class extencntrlTest{
    static testmethod void validateStandardController()
    {
        Account acc = new Account();
        acc.name ='Test';
        insert acc;
        
        ApexPages.StandardController sc = new ApexPages.StandardController(acc);
        extencntrl ext = new extencntrl(sc);
		ext.Save();
    }
    static testmethod void validateStandardController1()
    {
        Account acc = new Account();
        //acc.name ='Test';
        //insert acc;
         
        ApexPages.StandardController sc = new ApexPages.StandardController(acc);
        extencntrl ext = new extencntrl(sc);
        ext.Save();
    }
    
}


Please if someone knows what I need to add to it, please let me know, thanks!
 
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.
We know that, in production environment, we cannot make changes to a class (which contains the endpoint URL). If we are trying to deploy through CHANGE SETS, the same endpoint URL will be copied to production. Now, I want to understand that, when we use www.abc.com in sandbox but while deploying it to production, the URL should change to www.xyz.com because xyz is the main url for the webservice and we are using abc URL for testing purposes.

Can we do it using custom label?
Hello, Have two custom objects Obj1 and Obj2, there is a lookup relationship between them. Obj1 has a field 'Quantity'. Looking for help on trigger, to pass quantity values to Obj2 object (Field: Amount). Want to achieve this using Trigger and not process builder. Any help? Thanks!!
trigger PreventCustomertDeletion on Customer__c (before delete){
    Set<Id> allowedProfileIds = null;
	
	allowedProfileIds = new Map<id,profile>([SELECT ID FROM PROFILE WHERE NAME = 'Manager1']).keyset();
	
	for(Customer__c a : trigger.old){
		IF(allowedProfileIds.Contains(userInfo.getProfileId())){
			 a.addError('You do not have permission to delete the Customer');
		}
		
	}
}

Thanks in advance,
Dj
  • December 04, 2017
  • Like
  • 0
I've a junction object Pharma_Product_Invoice__c (M-D relation is on Pharma_Product__c and Invoice__c objects) which has a field called Quantity__c. Now i've added a Quantity__c field on Pharma_Product__c and want the Quantity values to pass from Pharma_Product_Invoice__c to Pharma_Product__c. I've tried using formula, but it doesn't work. Any suggestions?
Hey guys, I have a boolean variable called myBool. I want myBool to be true if conditions A, B and C are all met, and false otherwise. The easy way is to declare myBool and leave it null, create an if statement, and update the value of myBool to true or false based on the results of the if statement.

For the sake of prettier and less cumbersome code, I was wondering if there is a method you can call which acts like the Salesforce formula function 'AND'. The way AND works is that you give it some boolean arguments and if every argument evaluates to TRUE, then the whole AND function evaluates to TRUE. What is handy about this is that the arguments can be equations... so you could have something like : AND( 1 + 1 = 2, 2 + 2 = 4), and this would equal TRUE.

So is there a way to do this using Apex? The exact use case, if it helps to understand my question, is the following: I want to be able to write the following code: Boolean myBool = (equation). For equation I would like to insert a value on each side and see if they are the same (and the values could be any data type). If the values are the same, then myBool would be TRUE.

Any help would be greatly appreciated!
 
I would like to extract Lead and Campaign data from salesforce via SOAP API and utilize it for our lead and campaign analysis.

I am planning to retrieve each data and load into our DB seperately and conduct 'join' the both data within our DB.
At that point, I am wondering if I can link the Lead and Campaign...So I would love to know whether there is a field that enable me to link those data.

As far as I saw the Salesforce lead window, it can include campaign history, so I thought that using CampaignHistory would be the solution.
But It seems like there are no key fields to link Lead and Campaign in either objects after reading these references.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_campaignhistory.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_lead.htm

Does anyone know how to do that?
Any information would be helpful for me only if I can link those data.

Thank you.

Yusuke
Cannot figure out why this isn't working for me... are there steps missing in this?!

https://trailhead.salesforce.com/trails/get_smart_einstein/projects/predictive_vision_apex/steps/predictive_vision_apex_vf_page
Hello Everybody , 
Our team uses a set of standard project description which are copied and pasted into project description field each time they create a quote. This is time consuming.
Instead, I would like to create a picklist next to the description which would contain the subject line of the standard project description. So by selecting the picklist value the body of the project description is entered into description field. 
Could you please guide me on how this could be achieved. 
Thanks
Hello,

I have completed my apex specialist superbadge in first attempt but I did not receive any special badge related to first time ascent.

Does it take some time to get updated as I can only see simple super badge in my trailhead profile. 

Arpit
I have added notes and attachments to one of my Account, If I run the below query I am getting notes but not attachements
SELECT Id,name,(SELECT Id, Name FROM Attachments),(SELECT Id, Title FROM Notes) FROM Account
If I run seperate query on attachments, then also I am not getting any attachmants, the result is 0.
SELECT Id, Name FROM Attachment
Does anyone know why the count is getting zero? even though I have attachments in my org.
Once I save the Case comment(Related List of Case Object), I am unable to edit/delete it.

..Please Help..Thanks
Hi,

Can you please let me know how to delete the specific field on record level, means once save the record.

For example, i have saved account record as a test, In that record i have filled the value "Banglore" for address field. Now i need to delete that address field on record level. Can you please let me know how we can able to delete.

Thanks in advance.
Muni
I have a validation rule set to run that will prevent my team from converting a lead without the necessary information (see below). I want to allow them to convert the lead, though, if the Lead Status is equal to "Existing Customer". I also want all "Sales Admins" (Profile) to be able to convert while ignoring this validation rule.

How do I add those two exceptions to this rule?

AND(IsConverted, 
OR( 
ISBLANK( TEXT(LeadSource) ), 
ISBLANK( TEXT(Industry) ), 
ISBLANK( TEXT(Number_of_Agents__c) ), 
ISBLANK( Weekly_Volume_Tickets_Cases__c ), 
ISBLANK( TEXT( Email_Ticketing_Social_Platform__c )), 
ISBLANK( State), 
ISBLANK( Country)), 
NOT($Setup.Admin_Settings__c.Bypass_Validation__c) 

)
Hi All, 
here is issue as stated ..

Use Case -
As a account Manager, If I create a task/Event for a particular Account and assigned to me, it automatically shows on my Homepage as an upcoming tasks. The ask is that even Sales Ops(who is Inside Sales for this Account and mapped against this Account Manager), should also be able to see this Task under "My Tasks components" on the Home Page which I created.
Eg. Adam is Account Manager and created a task for Account "XYZ", it's shows under under Adam Task section on Home Page. Now,  Bhanu is Sales Ops mapped to account Manager Adam, even if Adam did not assign this task to Bhanu, Bhanu should also be able to view this Task under his ''My Tasks List'' on his Home Page.


plz reply on this 
Thanks !
Hi,
  
   I want to display the week number based  on quartrly of the year Please suggest me how to display
 
   Below is the image how it should be displayed
   User-added image

I wrote a formula which is giving quarter correctly but the week number is not displayed correclty
CASE(MONTH( CloseDate ),1,"Q4",2,"Q1",3,"Q1",4,"Q1",5,"Q2",6,"Q2",7,"Q2",8,"Q3",9,"Q3",10, "Q3",11,"Q4",12,"Q4","None")& "-W"&Text(CEILING( 
( 
DAY( CloseDate ) + 
MOD( DATE( YEAR( CloseDate ), MONTH( CloseDate ), 1 ) - DATE( 1900, 4, 1 ), 7 ) 
) / 7 
))

I need to display the weekly based on the image attached Please suggest me how to modifiy the formula.

Thanks
Sudhir
I have a validation rule:  AND( 
OR(BillingCountry = "US", BillingCountry = "USA", 
BillingCountry = "Hindustan"), 
NOT(REGEX(BillingPostalCode, 
"\\d{5}(-\\d{4})?")) )

I am not able to save  record after gave valid postal code.
Ex format:99999 or 99999-9999

Please let me know where i have done mistake
 
Hi Guys,

I have created a pageblock table where user can dynmically add and remove rows .In each rows I am using an input field .The problem I am facing while clicking the add row button its resetting the previous value entered in the previous row.Kindly help if anyone else faced the same problem .
<apex:page standardController="Account" extensions="AddnRemoveController" >
<apex:form id="f" >
<apex:pageMessages ></apex:pageMessages>
<div>
 <apex:pageBlock mode="maindetail" >
 <!-- <apex:variable value="{!0}" var="rowNumber" /> -->
  <apex:commandButton value="AddRow" action="{!addrow}" reRender="table">
  </apex:commandButton>
  <apex:commandButton value="Remove Row" action="{!removerow}" reRender="table">
  <!-- <apex:param value="" name="rowNum" assignTo="{!rowNum}" /> -->
  </apex:commandButton>
  
 
  <apex:pageBlockTable value="{!wrapList}" var="wrapVar" id="table">
  <!-- <apex:variable value="{!wrapVar.index}" var="rowNumber" /> -->
   <apex:column >{!wrapVar.index}</apex:column>
   <apex:column headervalue="{!wrapVar.act.Industry}">
    <apex:inputField value="{!wrapVar.act.Industry}" id="modalBankCountry"/>
   </apex:column>
  </apex:pageBlockTable>
   <apex:commandButton value="Save" action="{!saving}" />
 </apex:pageBlock>
 </div>
 </apex:form>
</apex:page>
 
<apex:page standardController="Account" extensions="AddnRemoveController" >
<apex:form id="f" >
<apex:pageMessages ></apex:pageMessages>
<div>
 <apex:pageBlock mode="maindetail" >
 <!-- <apex:variable value="{!0}" var="rowNumber" /> -->
  <apex:commandButton value="AddRow" action="{!addrow}" reRender="table">
  </apex:commandButton>
  <apex:commandButton value="Remove Row" action="{!removerow}" reRender="table">
  <!-- <apex:param value="" name="rowNum" assignTo="{!rowNum}" /> -->
  </apex:commandButton>
  
 
  <apex:pageBlockTable value="{!wrapList}" var="wrapVar" id="table">
  <!-- <apex:variable value="{!wrapVar.index}" var="rowNumber" /> -->
   <apex:column >{!wrapVar.index}</apex:column>
   <apex:column headervalue="{!wrapVar.act.Industry}">
    <apex:inputField value="{!wrapVar.act.Industry}" id="modalBankCountry"/>
   </apex:column>
  </apex:pageBlockTable>
   <apex:commandButton value="Save" action="{!saving}" />
 </apex:pageBlock>
 </div>
 </apex:form>
</apex:page>

 
Hi, 

  I need to create a formual field based on a date which quater it belongs to and the week 

  Example : Date = 1-Jan-2018 I need a formula to display as Q4-W1
                   Date = 1-Feb-2018 I need a formula to display as Q1-W1
                   Date = 8-Feb-2018 I need a formula to display as Q1-W2
                   Date = 1-May-2018 I need a formula to display as Q2-W1
                   Date = 8-May-2018 I need a formula to display as Q2-W2

Please suggest me how to get this done in using salesforce formula.

Thanks
Sudhir