• o raju
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 12
    Replies
Hi,

            Using metadata api i created object from visualforce page click save button.Again i try to create same object name from visualforce page using save button.
I got following error

mahesh.CreateObjectCls.MetadataServiceExamplesException: Error occured processing component MForm__c. The object name you specified already exists for your organization. You must specify a unique name across custom objects and article types. (DUPLICATE_DEVELOPER_NAME). Fields DeveloperName.
Error is in expression '{!createObject}' in component <apex:commandButton> in page bisoftsols:createobject

My requirement is when i click save button automatocally display error message as "Already exist your object name and  with yes and No buttons"
click Yes button:connect to another visualforce page
Click NO:Stay in that page only.
How to give please help me................
Hi,

        My string is looks like String name='rajesh__'+strfieldname+'__c';

Here how to remove rajesh__ and __c

I want to strfieldname only

help me......
Hi,
              Here object name through URL will come look like

https://Raju.ap1.visual.force.com/apex/Dynamicsetpage?DFN=ramobj
In My apex class i get this objects as using schema method and i displayed all fields

strtemp=ApexPages.currentPage().getParameters().get('DFN');
  
    this.DFN=strtemp;

     system.debug('*********objectselected//**********'+strtemp);
     String strFieldName = 'raju__'+DFN + '__c'; //Object name
       system.debug('*********objects**********'+strtemp);

My Question:How to give save functonality of this Dyamically getting object?

help me..........
Hi,

            Using metadata api i created object from visualforce page click save button.Again i try to create same object name from visualforce page using save button.
I got following error

mahesh.CreateObjectCls.MetadataServiceExamplesException: Error occured processing component MForm__c. The object name you specified already exists for your organization. You must specify a unique name across custom objects and article types. (DUPLICATE_DEVELOPER_NAME). Fields DeveloperName.
Error is in expression '{!createObject}' in component <apex:commandButton> in page bisoftsols:createobject

My requirement is when i click save button automatocally display error message as "Already exist your object name and  with yes and No buttons"
click Yes button:connect to another visualforce page
Click NO:Stay in that page only.
How to give please help me................
Hi,
        Actually i displayed all objects in a pageblocktable.One of the column is OwnercreatedDate.How to retrieve Object created dates in a ownercreatedDate table column?

help me..........
Hi,

        My string is looks like String name='rajesh__'+strfieldname+'__c';

Here how to remove rajesh__ and __c

I want to strfieldname only

help me......
Hi,
              Here object name through URL will come look like

https://Raju.ap1.visual.force.com/apex/Dynamicsetpage?DFN=ramobj
In My apex class i get this objects as using schema method and i displayed all fields

strtemp=ApexPages.currentPage().getParameters().get('DFN');
  
    this.DFN=strtemp;

     system.debug('*********objectselected//**********'+strtemp);
     String strFieldName = 'raju__'+DFN + '__c'; //Object name
       system.debug('*********objects**********'+strtemp);

My Question:How to give save functonality of this Dyamically getting object?

help me..........

Hi,

 

I am using metadata Api in java code to remove custom fields. I found below code from some blogs and they are mentions it is working code. But it is not working at my end. It always gives me below error.

 

Object with id:04s900000037qo4AAA is InProgress
Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: members - no CustomField named Custom_Field__c found
Object with id:04s900000037qo4AAA is Error

 

Below is the code:

 


    public void deleteCustomField(String fullname) throws Exception
    {
        CustomField customField = new CustomField();
        customField.setFullName(fullname);
        
        UpdateMetadata updateMetadata = new UpdateMetadata();
        updateMetadata.setMetadata(customField);
        updateMetadata.setCurrentName(fullname);
        
        AsyncResult[] asyncResults  = metadataConnection.delete(new Metadata[] {customField});
 
        long waitTimeMilliSecs = ONE_SECOND;
 
        do
        {
            printAsyncResultStatus(asyncResults);
            waitTimeMilliSecs *= 2;
            Thread.sleep(waitTimeMilliSecs);
            asyncResults = metadataConnection.checkStatus(new String[]{asyncResults[0].getId()});
        } while (!asyncResults[0].isDone());
 
        printAsyncResultStatus(asyncResults);
    }

 


    private void printAsyncResultStatus(AsyncResult[] asyncResults) throws Exception {
        if (asyncResults == null || asyncResults.length == 0 || asyncResults[0] == null) {
            throw new Exception("The object status cannot be retrieved");
        }

        AsyncResult asyncResult = asyncResults[0]; //we are creating only 1 metadata object

        if (asyncResult.getStatusCode() != null) {
            System.out.println("Error status code: " +
                    asyncResult.getStatusCode());
            System.out.println("Error message: " + asyncResult.getMessage());
        }

        System.out.println("Object with id:" + asyncResult.getId() + " is " +
            asyncResult.getState());
    }

 

Please help me, I want to mass delete custom fields.

 

Thanks,

Dhaval Panchal