• Rocks_SFDC
  • NEWBIE
  • 189 Points
  • Member since 2013
  • Salesforce Developer
  • CIS

  • Chatter
    Feed
  • 1
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 73
    Questions
  • 87
    Replies
Hi All,

We are using Einstein Platform Services for Object Detection and Image Classification by using Einstein language and Vision API. We are trying to find out the API to read the text contents on the image file that we have uploaded. 

I tried checking the website provided by salesforce: https://metamind.readme.io/. But couldn't find the proper info about it.

Can you guys please check and let me know what API we can make use to read the text contents on the image file.

Thanks,
Anil
I wanted to build following kind of table in salesforce lightning.
 
Terms and ConditionsOther 1Other 2
Standard  
    
    
    
    

Could anyone suggest how to proceed and help me out with any sample code.
Hi Folks,
I have created a custom button on the account detail page which will open the Visualforce page.

I have uploaded the file which is in pdf format in the Static Resource. Now i have displayed this static resource file in the visualforce page by using the following:

<apex:image url="{!$Resource.TestImage}" width="50" height="50"/>

Now i want to dislay merge fields data like Account Name, Industry, Phone fields on to the static resource file which is already displayed in visualforce pages

Thanks,
Anil

 
Hi Team,

I have created a button on the object and displayed in the detail page. Whenever this button is clicked, a visualforce page will open with PDF preview page with the content from detail page.

Now i have couple of questions below:
1. I want to send that file to the printer directly without showing the PDF preview.
2. I want to process the multiple records at the same time like batches. Here, Once we click on some universal button, then it will process all the records and all the files needs to be printed.

Could anyone please give any solutions for this requirement.

Thanks,
Anil

 
Hi Team,

I have a requirement where we just wanted to display the list of user's based on the permission we given.

Our input should be the permission name, then output should be the list of users those are having that permission.

Do we have any SOQL that supports this? or do we have any other workaround to display.

Thanks,
Anil



 
Hi Team,

We wanted to update the attribute (lets take Description) of set of custom fields (lets take 500) at a time across the different objects which includes both stantard and custom objects by using apex code.

Could anyone please let us know how to start this.

Thanks,
Anil
Hi Team,

We built the code where it will fetch the Metadata Components(Like Custom Fields, Workflows, Validation Rules) based on the Last Modified Date upon the button click on detail page.

But we are facing the following error:
Too many callouts: 101
Error is in expression '{!SaveRecord}' in component <apex:page> in page metadataretrieval3: Class.MetadataRetrieval3_Controller

MetadataRetrieval3_Controller code:

Public PageReference SaveRecord(){
 if(metaSync.selected_Metadata_Components__c.contains('Validation Rules')){
        String vId, ValMetadata='<?xml version="1.0" encoding="UTF-8"?>'+'\n'+'<Package xmlns="http://soap.sforce.com/2006/04/metadata">'+'\n'+'<types>'+'\n';
        Set<Id> ValRuleIds=new Set<Id>();
        Set<String> ValNames=new Set<String>();
        String text, text1;
        String valName;
        System.JSONToken token;
        SFDCToken tk = generateSFDCToken();
        List<String> ObjList=metaSync.selected_Objects__c.split(';');
        for(String ObjName: ObjList){
        Http h = new Http();
        HttpRequest req = new HttpRequest(); 
        req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
            String Inturl=tk.instance_url+'/services/data/v36.0/tooling/query?q=Select+Id+From+ValidationRule+where+LastModifiedDate>';
            String startDate=Inturl+String.Valueof(metaSync.start_Date__c).substringBeforeLast(' ')+'T00:00:00.000Z'+'+'+'AND'+'+';
            String endate=startDate+'LastModifiedDate<'+String.Valueof(metaSync.End_Date__c).substringBeforeLast(' ')+'T23:59:59.000Z'+'+'+'AND'+'+';
            String FullURL=endate+'EntityDefinition.DeveloperName=\'' +String.escapeSingleQuotes(objName)+'\'';   
       req.setEndpoint(FullURL);
        req.setMethod('GET'); 
        req.setHeader('Authorization', 'OAuth ' + tk.access_token);
        req.setTimeout(60000);
        HttpResponse res= new HttpResponse();
        res.setHeader('Content-Type', 'application/json');  
        res.setStatusCode(200);
        res = h.send(req); 
         if(res.getStatusCode() == 200)
           {
                JSONParser parser = JSON.createParser(res.getBody());   
                    while((token = parser.nextToken()) != null) {
                           if ((token = parser.getCurrentToken()) != JSONToken.END_OBJECT) {
                            text = parser.getText();
                           if (token == JSONToken.FIELD_Name && text == 'Id') {
                                token=parser.nextToken();
                                text1=parser.getText();
                                ValRuleIds.add(text1);
                             }
                 }
        }
       }
     }
        for(String valId : ValRuleIds){
        SFDCToken tk1 = generateSFDCToken();
          
            Http h1 = new Http();
            HttpRequest req1 = new HttpRequest(); 
            req1.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
            String url1=tk1.instance_url+'/services/data/v36.0/tooling/query?q=Select+FullName+From+ValidationRule+where+Id=\'' +String.escapeSingleQuotes(valId)+'\'';
            req1.setEndpoint(url1); 
            req1.setMethod('GET'); 
            req1.setHeader('Authorization', 'OAuth ' + tk1.access_token);
            req1.setTimeout(60000);
            HttpResponse res1= new HttpResponse();
            res1.setHeader('Content-Type', 'application/json');  
            res1.setStatusCode(200);
            res1 = h1.send(req1); 
            if(res1.getStatusCode() == 200)
                {
                    JSONParser parser1 = JSON.createParser(res1.getBody());   
                    while((token = parser1.nextToken()) != null) {
                    if ((token = parser1.getCurrentToken()) != JSONToken.END_OBJECT) {
                        text = parser1.getText();
                        if (token == JSONToken.FIELD_Name && text == 'FullName') {
                            token=parser1.nextToken();
                            valName=parser1.getText();
                           ValMetadata=ValMetadata+'<members>'+escapeSpecialChars(valName)+'</members>'+'\n';
                                    
                         }
                     }
                 }
                 
              }
          
          }
            ValMetadata2=ValMetadata+'<name>ValidationRule</name>'+'\n'+'</types>'+'\n'+'<version>34.0</version>'+'\n'+'</Package>';
      
      }
Update metaSync;
 if(ValMetadata2!=null){
            Attachment attachment=new Attachment();
            attachment.Body = Blob.valueof(ValMetadata2);
            attachment.Name = String.valueOf('Validation Rules-Metadata.txt');
            attachment.ParentId =metaSync.id;
            insert attachment; 
    }
}      

Could anyone please look on it and let us know the best approch for this.

Thanks,
Anil

 
Hi All,

We have unpackaged manifest xml file in Source Environment. Now, we wanted to deploy this to destination environment through apex code. Could anyone please provide me any workaround for this.

Thanks,
Anil
Hi Team,

When we try to send the REST API request from one salesforce instance (Sandbox) to another salesforce instance (Prod). We are receiving the following error:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

HttpRequest req= new HttpRequest(); 
req.setMethod('GET'); 
String username = 'test@salesforce.com'; 
String password = 'test123'; 
Blob headerValue = Blob.valueOf(username + ':' + password); 
String authorizationHeader = 'Basic' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader); 
Http http = new Http(); 
String url = 'https://na1.salesforce.com/services/data/v36.0/tooling/query?q=Select+Id,Name,TableEnumOrId,LastModifiedDate+From+WorkflowRule+Where+LastModifiedDate>2016-01-01'; 
req.setEndpoint(url ); 
HttpResponse res = http.send(req); 
System.debug('AAAAAAAA' +res.getBody());

Could you please anyone check and let us know what modifications required on above code.

Thanks,
Anil


        
Hi Folks,

I wanted to query metadata components( Fields, Objects, Validation Rules, Workflow Rules, Approval Process..etc) by using SOQL query in Apex. So, Could you please anyone check let me know do we have any workaround for this.

i'm just curious about whether is it possible by using Query or not.

Thanks,
Anil
Hi Folks,

One of the user is receiving the following error.

Update failed. First exception on row 14 with id XXXXXXXXXXXXXX; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You do not have the appropriate permissions to edit this field.:[WhatId].

Could anyone let me know what might be the problem for the above error.

Thanks,
Anil
Hi Team,

We want to append "some text" lets say "Copy" to the Name field of a custom object when we click on "Clone" button.

Do we have any workaround for this.

If any one post sample code, then that could be great helpful.

Thanks,
Anil
Hi Team,

I would like to set the value for the name field for custom object in visual force page when we click on the "New" button. I just want to pre-populate the value to "Some Text". Can anyone help me out ?

Thanks,
Anil
Hi Team,

We have one custom object from the managed package. we want to create the replica of the same object with attachmnets records. In this process, we have created custom object and inserted all the records from old custom object.

Now we want to transfer the attachment records associated with the old custom object to another custom object.

Please sugguest any procedure we need to follow or do we have any custom code to accomplish this.

Thanks in Advance,
Anil
Hi All,

I just want to create an visualforce page for Lead object. In the visualforce page, i want to include the lead fields and the interface that allows the user to select the file(Browse button). Then once we click on "Save" button, then lead will be created with an attachment.

This requirement i want to do it without <apex:inputFile> tag.

Could anyone please check and let me know your concerns on this.

Thanks in Advance,
Anil
Hi All,

When we are trying to insert the "Price Book Entry" records. Few records got inserted from the CSV file and for few records we are facing the following error:

"This price definition already exists in this price book"

Could you please check and let me know what was the cause of the error. Any modifications do we need to make in CSV file.

Please suggest.

Thanks,
Anil
Hi All,

I want to insert Opportunity Line Item for an Opportunity by using Apex Data Loader.

I want to do upsert operation and i want to use "External ID".

So, could anyone please give the steps do the same.

Thanks,
Anil
Hi All,

This is really interesting thing i am into now.

I have one production environment related to X company and another production environment related to Y company. Now my requirement is to migrate the meta - data(like fields, objects, triggers, visualforce pages .... etc) and data(like records for each object) from one production environment into another production environment.
So now the question is:
What are the best ways we can do the migration.
Do we need to follow any order.
What are all precautions we can do in this type of projects.

Thanks in Advance,
Anil
Hi Developers,

I have product object and custom object(Designations__c). We have look up relationship between product and designation__c(Parent: Product, Child: Designation__c)
Fields:
On Product Object: Total Amount (Data Type:Currency)
On Designations Object: Amount(Data Type: Currency)

Now, The sum of amount of related designation records should not exceed 100 for an product record.

I want to applicable the functionality for Insert, Update and Delete operations.

Please help me out with the code.

Thanks,
Rocks
Hi Team,
This is some interesting question just want to share with you guys.

We have one application which consists of custom objects,custom tabs, custom fields, validation rules, workflow rules and other components like triggers and visualforce pages ..etc

Now i want to look on the top improvements we can do in this application.

Could you please let me know how we can proceed to do improvements for an application.

Cheers,
Anil

 
Hi All,

I have a requirment that i need to update submitted user for all the apex scheduled jobs in my Prod. So, Could you please let me know that how we can do without deleting and recreate them.

Thanks,
Anil
Hi Folks,

I am new to chatter functionality.

we have "CollaborationGroup" and "FeedItem"

How to query on FeedItem and get  CollaborationGroup items.

After getting CollaborationGroup, i want to get the attachment id from it.

Please clarify !!!

Thanks,
Anil


Hi Team,

 

In Text type of Email Templates, i want to specify logged in user as merge field. Could anyone have any suggestions.

I have tried with the following lines. But it is not working.

 

$User.FirstName

{!User.FirstName}

 

 

Thanks,

Anil

Hi,

Below is the batch apex and Test class.

global class DeleteCaseData implements Database.Batchable<SObject>, Database.Stateful{ 
    global Map<Id, String> errorMap {get; set;}
    global Map<Id, SObject> IdToSObjectMap {get; set;}
    
    global DeleteCaseData(){
        errorMap = new Map<Id, String>();
        IdToSObjectMap = new Map<Id, SObject>();
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC) { 
        String clsDat = Date.today().addmonths(120).adddays(1).format(); //Date.today().adddays(1).format();
        system.debug('----clsdat----'+clsDat);
        String query = 'Select Id, status,Category__c,Origin From Case where status = \'Closed\''; 
        if(clsDat != null){
            query = query + ' AND ' + '( X18_Months__c =: clsDat OR X120_Months__c = :clsDat) ';
            system.debug('----query-1----'+query); //X18_Months__c =: clsDat OR
        }
        return Database.getQueryLocator(query);
    } 
    
    global void execute(Database.BatchableContext BC, List<SObject> scope) { 
        List<Case> CaseList = new List<Case>();
        for(SObject s : scope){
            Case cs = (Case) s;
            //cs.Status = 'New';
            CaseList.add(cs);
        }
        
        if(CaseList.size() > 0) {
            List<Database.DeleteResult> casdele = Database.delete(CaseList, false);
            Integer index = 0;
            for(Database.DeleteResult dsr : casdele){
                if(!dsr.isSuccess()){
                    String errMsg = dsr.getErrors()[0].getMessage();
                    errorMap.put(CaseList[index].Id, errMsg);
                    IdToSObjectMap.put(CaseList[index].Id, CaseList[index]);
                }
                index++;
            }
        }
    } 
    
    global void finish(Database.BatchableContext BC) { 
        //Send an email to the User after your batch completes 
        if(!errorMap.isEmpty()){
            string myid = 'ecsfdc.in@capgemini.com';
            //List<User> usrs = [Select id,email from user where profile.name = 'System Administrator'];
            AsyncApexJob a = [SELECT id, ApexClassId,JobItemsProcessed, TotalJobItems,NumberOfErrors, CreatedBy.Email FROM AsyncApexJob WHERE id = :BC.getJobId()];
            String body = 'Hi,\n \n' + 'The batch job ' + 'DeleteCaseData ' + 'has finished. \n' + 'There were ' + errorMap.size() + ' errors. Please find the error list attached. \n \n Thanks,';
            
            // Creating the CSV file
            String finalstr = 'Id, CaseNumber, Error \n';
            String subject = 'Case - Apex Batch Error List';
            String attName = 'Delete Case Errors.csv';
            for(Id id  : errorMap.keySet()){
                string err = errorMap.get(id);
                Case Cse = (Case) IdToSObjectMap.get(id);
                string recordString = '"'+id+'","'+Cse.CaseNumber+'","'+err+'"\n';
                finalstr = finalstr +recordString;
            } 
            
            // Define the email
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
            
            // Create the email attachment    
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            efa.setFileName(attName);
            efa.setBody(Blob.valueOf(finalstr));
            
            // Sets the paramaters of the email
            email.setSubject( subject );
            email.setToAddresses( new String[] {myid} );
            email.setPlainTextBody( body );
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            
            // Sends the email
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});   
        }
    } 
}

Test Class:

@isTest
public class DeleteCaseData_Test {
    
    Public static testMethod void myUnitTest() {
        
        Account ac = new Account();
        ac.Name = 'Test';
        ac.Customer_Serno__c = '123';
        insert ac;
        
        Contact con = new Contact();
        con.LastName = 'Testing';
        con.SSN__c='353535353535';
        con.SerNo__c='4353077';
        insert con;
        
        Product_Custom__c pd = new Product_Custom__c();
        pd.Name = 'Test';
        pd.Pserno__c = '1542';
        insert pd;
        
        Financial_Account__c fa = new Financial_Account__c();
        fa.Product__c = pd.id;
        fa.Account_Serno__c = '1200';
        fa.Account_Number__c = '125646456';
        fa.Customer__c = ac.Id;
        fa.Customer_Serno__c = '126464';
        fa.Product_Serno__c = '454564';
        insert fa;
        
        Card__c cd = new Card__c();
        cd.Card_Number_Truncated__c = '353453******5345';
        cd.Product__c = pd.Id;
        cd.People_Serno__c = '12456465';
        cd.Card_Serno__c = '45785415';
        cd.Prod_Serno__c='4746565';
        cd.People__c = con.Id;
        cd.Financial_Account__c =fa.Id;
        cd.Financial_Account_Serno__c = '784966';
        insert cd;
        
        List<Case> cslist = new List<Case>();
        Case cs = new Case();//(Status='New',Origin = 'Email', Category__c='None');
        cs.AccountId = ac.Id;
        cs.Financial_Account__c = fa.Id;
        cs.ContactId = con.Id;
        cs.Origin = 'email';
        cs.Status='Closed';
        cs.Card__c = cd.Id;
        cs.X120_Months__c = '2028-03-28';
        cs.X18_Months__c ='2019-03-28';
        cs.Category__c = 'None';
        cslist.add(cs);
        Insert cslist;
        
        Test.StartTest();
        
        DeleteCaseData casedelete = new DeleteCaseData();
         ID batchprocessid = Database.executeBatch(casedelete);
    
        Test.StopTest();   

    }
}
<td class="slds-cell-shrink" data-label="Select Row" style="width:8%;border: 1px solid #cecfd5;padding: 1px 2px;text-align: center;">
                                                <div aura:id="tycoon"> 
                                                  <!--  <input type="checkbox" name="{!ntwrk.CheckValStatus}" id="{!ntwrk.nwID}" onclick="{!c.testCall}" checked="{!ntwrk.CheckValStatus}" value="{!ntwrk.state}"/>
                                               --> <ui:inputCheckbox aura:id="abcd" name="{!ntwrk.CheckValStatus}"  change="{!c.testCall}" value="{!ntwrk.state+}"/>
                                                                                                                                
                                                
                                                </div>                                                                                                   
                                                <span class="slds-checkbox--faux"></span>
                                                <span class="slds-assistive-text">Select All</span>
                                            </td>  
JS CTR-->

var networkCheck = document.querySelectorAll('#' + 'abcd' + ' input[type="checkbox"]');                                                                                                                                        
    
var networkCheck = component.getElement().querySelectorAll('#' + 'abcd' + ' input[type="checkbox"]');

both the lines are not working and geting null values in "networkCheck ".
Any help would be really grateful.
Hi Team,

I have a requirement where we just wanted to display the list of user's based on the permission we given.

Our input should be the permission name, then output should be the list of users those are having that permission.

Do we have any SOQL that supports this? or do we have any other workaround to display.

Thanks,
Anil



 
Hello,

Before I spend a ton of time researching the plausibility of what we want to do I wanted to ask the forum. 

We have many attachments on the Opportunity object, and part of our process when we close opportunities is to print all the attachments associated. 
Due to the clunkiness of printing each attachment it takes quite a bit of time to do this. Is it possible to print all the attachments from a visualforce page thats called by a button click? 

I've read similar requests but I haven't seen if it's actually plausible.

thanks in advance! 
Hi Team,

We wanted to update the attribute (lets take Description) of set of custom fields (lets take 500) at a time across the different objects which includes both stantard and custom objects by using apex code.

Could anyone please let us know how to start this.

Thanks,
Anil
Hi Team,

We built the code where it will fetch the Metadata Components(Like Custom Fields, Workflows, Validation Rules) based on the Last Modified Date upon the button click on detail page.

But we are facing the following error:
Too many callouts: 101
Error is in expression '{!SaveRecord}' in component <apex:page> in page metadataretrieval3: Class.MetadataRetrieval3_Controller

MetadataRetrieval3_Controller code:

Public PageReference SaveRecord(){
 if(metaSync.selected_Metadata_Components__c.contains('Validation Rules')){
        String vId, ValMetadata='<?xml version="1.0" encoding="UTF-8"?>'+'\n'+'<Package xmlns="http://soap.sforce.com/2006/04/metadata">'+'\n'+'<types>'+'\n';
        Set<Id> ValRuleIds=new Set<Id>();
        Set<String> ValNames=new Set<String>();
        String text, text1;
        String valName;
        System.JSONToken token;
        SFDCToken tk = generateSFDCToken();
        List<String> ObjList=metaSync.selected_Objects__c.split(';');
        for(String ObjName: ObjList){
        Http h = new Http();
        HttpRequest req = new HttpRequest(); 
        req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
            String Inturl=tk.instance_url+'/services/data/v36.0/tooling/query?q=Select+Id+From+ValidationRule+where+LastModifiedDate>';
            String startDate=Inturl+String.Valueof(metaSync.start_Date__c).substringBeforeLast(' ')+'T00:00:00.000Z'+'+'+'AND'+'+';
            String endate=startDate+'LastModifiedDate<'+String.Valueof(metaSync.End_Date__c).substringBeforeLast(' ')+'T23:59:59.000Z'+'+'+'AND'+'+';
            String FullURL=endate+'EntityDefinition.DeveloperName=\'' +String.escapeSingleQuotes(objName)+'\'';   
       req.setEndpoint(FullURL);
        req.setMethod('GET'); 
        req.setHeader('Authorization', 'OAuth ' + tk.access_token);
        req.setTimeout(60000);
        HttpResponse res= new HttpResponse();
        res.setHeader('Content-Type', 'application/json');  
        res.setStatusCode(200);
        res = h.send(req); 
         if(res.getStatusCode() == 200)
           {
                JSONParser parser = JSON.createParser(res.getBody());   
                    while((token = parser.nextToken()) != null) {
                           if ((token = parser.getCurrentToken()) != JSONToken.END_OBJECT) {
                            text = parser.getText();
                           if (token == JSONToken.FIELD_Name && text == 'Id') {
                                token=parser.nextToken();
                                text1=parser.getText();
                                ValRuleIds.add(text1);
                             }
                 }
        }
       }
     }
        for(String valId : ValRuleIds){
        SFDCToken tk1 = generateSFDCToken();
          
            Http h1 = new Http();
            HttpRequest req1 = new HttpRequest(); 
            req1.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
            String url1=tk1.instance_url+'/services/data/v36.0/tooling/query?q=Select+FullName+From+ValidationRule+where+Id=\'' +String.escapeSingleQuotes(valId)+'\'';
            req1.setEndpoint(url1); 
            req1.setMethod('GET'); 
            req1.setHeader('Authorization', 'OAuth ' + tk1.access_token);
            req1.setTimeout(60000);
            HttpResponse res1= new HttpResponse();
            res1.setHeader('Content-Type', 'application/json');  
            res1.setStatusCode(200);
            res1 = h1.send(req1); 
            if(res1.getStatusCode() == 200)
                {
                    JSONParser parser1 = JSON.createParser(res1.getBody());   
                    while((token = parser1.nextToken()) != null) {
                    if ((token = parser1.getCurrentToken()) != JSONToken.END_OBJECT) {
                        text = parser1.getText();
                        if (token == JSONToken.FIELD_Name && text == 'FullName') {
                            token=parser1.nextToken();
                            valName=parser1.getText();
                           ValMetadata=ValMetadata+'<members>'+escapeSpecialChars(valName)+'</members>'+'\n';
                                    
                         }
                     }
                 }
                 
              }
          
          }
            ValMetadata2=ValMetadata+'<name>ValidationRule</name>'+'\n'+'</types>'+'\n'+'<version>34.0</version>'+'\n'+'</Package>';
      
      }
Update metaSync;
 if(ValMetadata2!=null){
            Attachment attachment=new Attachment();
            attachment.Body = Blob.valueof(ValMetadata2);
            attachment.Name = String.valueOf('Validation Rules-Metadata.txt');
            attachment.ParentId =metaSync.id;
            insert attachment; 
    }
}      

Could anyone please look on it and let us know the best approch for this.

Thanks,
Anil

 
Hi Folks,

I wanted to query metadata components( Fields, Objects, Validation Rules, Workflow Rules, Approval Process..etc) by using SOQL query in Apex. So, Could you please anyone check let me know do we have any workaround for this.

i'm just curious about whether is it possible by using Query or not.

Thanks,
Anil
Hi Team,

We want to append "some text" lets say "Copy" to the Name field of a custom object when we click on "Clone" button.

Do we have any workaround for this.

If any one post sample code, then that could be great helpful.

Thanks,
Anil
Hi Team,

I would like to set the value for the name field for custom object in visual force page when we click on the "New" button. I just want to pre-populate the value to "Some Text". Can anyone help me out ?

Thanks,
Anil
Hi Developers,

I have product object and custom object(Designations__c). We have look up relationship between product and designation__c(Parent: Product, Child: Designation__c)
Fields:
On Product Object: Total Amount (Data Type:Currency)
On Designations Object: Amount(Data Type: Currency)

Now, The sum of amount of related designation records should not exceed 100 for an product record.

I want to applicable the functionality for Insert, Update and Delete operations.

Please help me out with the code.

Thanks,
Rocks

BELOW IS MY CODE ON THE BUTTON:

 

{!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}
var smid = '{!Sales_Memo__c.Id}';
var result = sforce.connection.query("select Id, No_of_Prints__c From Sales_Memo__c where Id = '{!Sales_Memo__c.Id}' limit 1");
var records = result.getArray("records");
if (records.length > 0) {
var record = records[0];
var i = record.No_of_Prints__c;
record.No_of_Prints__c = ++i;
var result = sforce.connection.update([record]);
if(result[0].getBoolean("success")) {
window.open("https://ap1.salesforce.com/apex/SMPDF_re?id="+smid);
document.location.reload();
}
else {
window.alert ("failed to update Sales Memo " + result[0]);
}
}
else {
window.alert ("No record found for Sales Memo Id : {!Sales_Memo__c.Id}" );
}

 

  • January 04, 2013
  • Like
  • 0

Ultimately I am wanting to create a custom field called PO Received Month which pulls the month of the PO Received Date field, but in text format, not number format.

 

Currently this is the formula I put in the Formula Text field but its spitting out "4" for April and "5" for May and I want it to read "April" and "May".

 

 

TEXT(( YEAR( PO_Received_Date__c )))

 Thanks in advance!

 

how many master detail relationships and lookup relationships can you have on an object.

 

 

 

shan