function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yoshinori MoriYoshinori Mori 

yourObject stands for something as default?

I would like to know if 'yourObject' is used within Apex as defalt?

 

Thanks

Mori

bob_buzzardbob_buzzard

I don't believe this is the case - I've just created a custom class called 'yourObject' and it compiled without problem.

Yoshinori MoriYoshinori Mori

Dear bob_buzzard

 

I was just wondering if something like "yourObject.Name = 'none' " is executed somewhere within the classes would afferect entire organization or some other classes.

I would like make it sure it doesn't affect anything.

 

Thanks

Mori 

 

bob_buzzardbob_buzzard

This indicates that yourObject is an sobject or instance of a custom class, in which case the assignment will only affect that particular item.

Yoshinori MoriYoshinori Mori

Dear Bob Buzzard

 

Thank you for the explanation.

I understood.

 

I still have a wonder why there was a message "Method Not available" which my part doesn't call or is not related to.

 

Mori

 

bob_buzzardbob_buzzard

This sounds like a missing setter or similar.

 

Can you post your code?

Yoshinori MoriYoshinori Mori

Dear bob_buzzard

 

Test Class is as below.

 

@isTest

private class A class {

    static testMethod void myUnitTest() {

 

A class controller = new  A class();

controller.YourObject.Name = null;

controller.save( );

}

 

The A class to be run-tested is as below.

 

public with sharing class A class {

public List<Datastore__C> objecttobesotred { get; set; }

-----------------------------------------abbreviation-----------------

(initializing programming code from List object)

(setdata to object  programming code)

---------------------------------------------------------------------------

 

public PageReference save()
    {
        try {
            upsert objecttobestored;
            init();
            inputflg = false;
        } catch (DmlException de) {
            System.debug(de.getMessage());
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, de.getMessage()));
        }
        return null;
    }

 

There might be a slight possibility that controller.YourObject.Name = null; was ran

 

Thanks

Mori 

bob_buzzardbob_buzzard

The controller would need a property of yourObject in order for that line to successfully run.