• Marcel Meijer 2
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi,

I need to access the translations of the values in a picklist so I can update the translations of the picklistvalues. (We need to do this for 60+ orgs)

First I need to get the customObjectTranslation which has an array of fields of type CustomFieldTranslations. Then I can update the picklistvalueTranslations by looping through the list of picklistvalueTranslations. After this I can do an update of the customObjectTranslation.
But I'm stuck at step 1. I use the following code to get the customObjectTranslations:
 
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
service.timeout_x = 120000;

list<String> tList = new list<String>();
tList.add('myp__Employee__c-en_US');
MetadataService.ReadCustomObjectTranslationResult tr = (MetadataService.ReadCustomObjectTranslationResult)service.readMetadata('CustomObjectTranslation', tList);



However, when I debug the result, tr.records[0].fields is null. tr.records[0] does give a record with fullname=myp__Employee__c-en_US but if I use a nonexisting sObject name it also gives a record back with the nonexisting sObjectName in the fullName field.

I can read data like picklists from an sObject, external site settings, etc.. via the Metadata API and then update them. So the Metadata API is working fine.

Can anyone help out with this as there is a very limited amount of information on the internet?
 
 
Hi,
We have a custom tab that redirects the user to the page we want them to see.
This worked fine for portal users. We recently migrated all the users from portal to platformlicenses and now we have this anoying issue:
When the user first logs in the redirect doesn't work.
When the users logs in for a second time it does work. Even if it's from another browser (so no cookie issue).
The TAB vfpage is:
<apex:page controller="RedirectCon" title="Startpagina" action="{!redirectPage}">

</apex:page>

And the apex code is:
public with sharing class RedirectCon {

  public RedirectCon(){

  }
  
  public PageReference redirectPage() {
    Profile prof = [SELECT Name FROM profile WHERE id = :UserInfo.getProfileId()];
    hr2d__Redirect__c eicRedirect;

    try {
      eicRedirect = hr2d__Redirect__c.getInstance(prof.Name);
    } catch (Exception e) {
    }


    if(eicRedirect != null) {
        String redirectPageAdress = eicRedirect.hr2d__eic__c;

        redirectPageAdress = '/' + redirectPageAdress;  //@9.0 RP

        PageReference redirectPage = new PageReference(redirectPageAdress);
        redirectPage.setRedirect(true);

        return redirectPage;
    } else {
        String redirectPageAdress = '/home/home.jsp';

        PageReference redirectPage = new PageReference(redirectPageAdress);
        redirectPage.setRedirect(true);

        return redirectPage;
    }
  }
}

We assigned it to the tab with the name '.' which is default set to on
Any assistance would be appreciated.

Thanks!
​​​​​​​Marcel
 
 
Hi,

I need to access the translations of the values in a picklist so I can update the translations of the picklistvalues. (We need to do this for 60+ orgs)

First I need to get the customObjectTranslation which has an array of fields of type CustomFieldTranslations. Then I can update the picklistvalueTranslations by looping through the list of picklistvalueTranslations. After this I can do an update of the customObjectTranslation.
But I'm stuck at step 1. I use the following code to get the customObjectTranslations:
 
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
service.timeout_x = 120000;

list<String> tList = new list<String>();
tList.add('myp__Employee__c-en_US');
MetadataService.ReadCustomObjectTranslationResult tr = (MetadataService.ReadCustomObjectTranslationResult)service.readMetadata('CustomObjectTranslation', tList);



However, when I debug the result, tr.records[0].fields is null. tr.records[0] does give a record with fullname=myp__Employee__c-en_US but if I use a nonexisting sObject name it also gives a record back with the nonexisting sObjectName in the fullName field.

I can read data like picklists from an sObject, external site settings, etc.. via the Metadata API and then update them. So the Metadata API is working fine.

Can anyone help out with this as there is a very limited amount of information on the internet?
 
 
I'm new to visualforce but trying to edit a page built by another. I need to set a picklist value, that can be changed on the form, to a value defined in the URL.

The URL that is pass includes:

?channel=email&market=1&lang=en

I'm trying to set the market picklist here:

<div class="new-subform-component form-group field">
     <label for="select_market" class="control-label id="select_market">{!$Label.Select_Market}:</label>
     <div>
          <apex:inputField value="{!caseObj.Case_Market__c}"
               Styleclass="form-control caseMarket" required="true" id="market" onchange="UpdateCountryCode()" />
     </div>
</div>

This is pulling the options from the Case.Case_Market__c field. Each Market(Country) as an API value that is a number but of course the number is considered text type.

If I add an onload function:

window.onload=function() {
                $('.caseMarket').val('1');
        };

This works, 1 = USA

Anything refencing the URL parameter, doesn't work such as:

var xMarket = '{($CurrentPage.parameters.market == null, '1', $CurrentPage.parameters.market)}';

window.onload=function() {
            if (xMarket == "1"){
                $('.caseMarket').val('1');
            } else if (xMarket == "2") {
                $('.caseMarket').val('2');
            }
            UpdateCountryCode()
        };

Or setting the .caseMarket by parameter on load:

window.onload=function() {
     $('.caseMarket').val('$CurrentPage.parameters.market');
}

I have tried many, many different ways of doing this, all failing. Ideas?