• motti10
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 4
    Replies
I created a custom TAB which loads a list of Assets on an ApexPage. I click on the Asset Name and now want to send the Asset name I clicked to my Controller so that I can do :queries like:

 

Asset myasset = SELECT name from Asset where name = :[CLICKED ASSET NAME TEXT]

 

How can I retrieve the AssetName so I can you it in my controller?

 

BTW I have enhanced list to view Assets on page

 

Thank you

I created a custom TAB which loads a list of Assets on an ApexPage. I click on the Asset Name and now want to send the Asset name I clicked to my Controller so that I can do :queries like:

 

Asset myasset = SELECT name from Asset where name = :[CLICKED ASSET NAME TEXT]

 

How can I retrieve the AssetName so I can you it in my controller?

 

BTW I have enhanced list to view Assets on page

 

Thank you

Thanks..

 

I may be missing something, but i am trying to post to this example URL


'http://]URL]/services/v1/rest/Scripto/execute/HelloWorld?username=[user]&password=V[pwd]&foo=hello')

 

It will return "hello"

 

Here is my "Groovy code that works)

 

 import org.apache.commons.httpclient.Credentials
 import org.apache.commons.httpclient.HostConfiguration
 import org.apache.commons.httpclient.HttpClient
 import org.apache.commons.httpclient.UsernamePasswordCredentials
 import org.apache.commons.httpclient.auth.AuthScope
 import org.apache.commons.httpclient.methods.GetMethod
 import org.apache.commons.httpclient.methods.PostMethod
 import org.apache.commons.httpclient.NameValuePair
 
 
 public static String httpGet(String urlStr) throws IOException {
  URL url = new URL(urlStr);
  HttpURLConnection conn =
      (HttpURLConnection) url.openConnection();

  if (conn.getResponseCode() != 200) {
    throw new IOException(conn.getResponseMessage());
  }

  // Buffer the result into a string
  BufferedReader rd = new BufferedReader(
      new InputStreamReader(conn.getInputStream()));
  StringBuilder sb = new StringBuilder();
  String line;
  while ((line = rd.readLine()) != null) {
    sb.append(line);
  }
  rd.close();

  conn.disconnect();
  return sb.toString();
}

httpGet ('http://]URL]/services/v1/rest/Scripto/execute/HelloWorld?username=[user]&password=V[pwd]&foo=hello')

 

Can I implement this same thing?



My Product has REST base webservices have data from different sources.

 

How can I code APEX to return results based on calling my REST services and returning the data and then show it in VisualSource?

 

Thanks

I am trying to create a new Product with REST (using Groovy)

 

 

product= [
"ProductName":"test",
]

def jsonString = JSONObject.fromObject(product).toString(2)

 

http.request( POST ) {
contentType = JSON
    uri.path = '/services/data/v20.0/sobjects/Product/'
uri.query = [_HttpMethod:'POST']
 
 send JSON, jsonString
  headers.'Authorization' = "OAuth $accessToken"

 

 
 }
}



 

I get

INFO - {
 "faultcode ": "Groovy Exception",
 "faultstring": "Bad Request"
}

 



I am trying to Add Asset Name and other to the Case Page

Can this be done via Apex tRiggers or other ?

I am trying to create a Contact in SFDC without assigning it an Account or anything else.

I want to create it and then assign it to a case or Asset , etc

 

Any ideas?

 

Thanks

My Product has REST base webservices have data from different sources.

 

How can I code APEX to return results based on calling my REST services and returning the data and then show it in VisualSource?

 

Thanks

I created a custom TAB which loads a list of Assets on an ApexPage. I click on the Asset Name and now want to send the Asset name I clicked to my Controller so that I can do :queries like:

 

Asset myasset = SELECT name from Asset where name = :[CLICKED ASSET NAME TEXT]

 

How can I retrieve the AssetName so I can you it in my controller?

 

BTW I have enhanced list to view Assets on page

 

Thank you

My Product has REST base webservices have data from different sources.

 

How can I code APEX to return results based on calling my REST services and returning the data and then show it in VisualSource?

 

Thanks

I am trying to create a Contact in SFDC without assigning it an Account or anything else.

I want to create it and then assign it to a case or Asset , etc

 

Any ideas?

 

Thanks